Learn Metal

I am interested in learning the Metal framework for rendering development. However, most of Apple’s official documentation uses Objective-C code. Therefore, I am seeking guidance on whether it is more advantageous for me to focus solely on learning Swift to gain proficiency in Metal.

Answered by DTS Engineer in 822949022

As Etresoft mentions, there is a longer history of Metal and Objective-C, and the Metal Shading Language is a subset of C++.

Nonetheless, Metal is effectively the same API if you write your app's code in Swift, Object-C or C++ (see Metal-cpp).

The only thing you might find more challenging learning with Swift is passing data to the GPU i.e. memory management. This visionOS sample provides an example Interacting with virtual content blended with passthrough (and runs on Simulator).

Metal uses a subset of C++. Most of that code you're looking at is just the boilerplate setup code from years ago. That's why it still uses Objective-C. It should be easy to convert to Swift.

Accepted Answer

As Etresoft mentions, there is a longer history of Metal and Objective-C, and the Metal Shading Language is a subset of C++.

Nonetheless, Metal is effectively the same API if you write your app's code in Swift, Object-C or C++ (see Metal-cpp).

The only thing you might find more challenging learning with Swift is passing data to the GPU i.e. memory management. This visionOS sample provides an example Interacting with virtual content blended with passthrough (and runs on Simulator).

Learn Metal
 
 
Q