Post

Replies

Boosts

Views

Activity

Reply to Launch Screen in SwiftUI
Hi, the "Launch screen interface file base name" or UILaunchStoryboardName in the Info.plist is for a LaunchScreen.storyboard file. It will show before your app is loaded. Tho as soon as your app is loaded, your ContentView will appear, and if you need to "extend" the launch screen, while other things are loading, I recommend replicating your launch screen in a SwiftUI View, then add it to the top of your UI in a ZStack and wrap your launch view in an if statement for a @State var loading: Bool = true. Once your app data is loaded just call: withAnimation { loading = false }
Jul ’20
Reply to Swift Package with Metal
I was successfully able to copy my metallib resources to my swift package target with swift-tools-version:5.3 I added a folder with different metallib files in my target like this: resources: [.copy("Metal/")] Then I could access my metallib url via this code: let metalLibURL: URL = Bundle.module.url(forResource: "MyMetalLib", withExtension: "metallib", subdirectory: "Metal")! Note that Bundle.module is only available once you have specified your resources in the package manifest. Then I could access my shader without any problem: guard let metalDevice: MTLDevice = MTLCreateSystemDefaultDevice() else { return } guard let metalLib: MTLLibrary = try? metalDevice.makeLibrary(filepath: metalLibURL.path) else { return } guard let metalShader: MTLFunction = metalLib.makeFunction(name: "myMetalFunc") else { return } Regarding a future Swift & Metal Package with only .swift & .metal files, and no .metallib resources, there would be no special settings I would need, just access to the MTLFunction shaders. Anton ⬢ hexagons.net
Jun ’20
Reply to SwiftUI + Metal
Hi, SwiftUI is very high level and Metal is very low level, so you need some middle ground. In short you can wrap a MTKView - https://developer.apple.com/documentation/metalkit/mtkview in a UIViewRepresentable - https://developer.apple.com/documentation/swiftui/uiviewrepresentable, tho you need to setup a render pipeline. I would start by looking through some Metal Sample Code - https://developer.apple.com/metal/sample-code/ to get started.
Jun ’20