Discover Metal for immersive apps - Example Code

Is there an example app?

Am writing a visual music app. It uses a custom SwiftUI menus over a UIKit (UIHostingController) canvas. The metal pipeline is custom.

A fully functional example app would be super helpful. Nothing fancy; an immersive hello triangle would be a great start.

Later, will need to port UITouches to draw and CMMotionManager to track pov within a Cubemap. Meanwhile, baby steps.

Thanks!

Accepted Answer

There is example code from Warren Moore found here using Apple's low level C API found here

Thanks warrenm!

However, I find the C++/ObjC++ APIs with super_long_snake_case_names to be obscure and non-idiomatic. So, am attempting to port to Swift. Already filed a Feedback requesting Swift APIs (FB12879060). And will post a separate question on some blockers in my attempt to refactor into idiomatic Swift.

Full port of C++ to Swift is working. Code is here

Xcode 15 (beta 6) has a template app for creating an Immersive app using Metal. You can find it if you create a new App for visionOS and set "Immersive Space Renderer" to Metal.

Discover Metal for immersive apps - Example Code
 
 
Q