Post

Replies

Boosts

Views

Activity

Reply to Integrate Metal/ObjC Tutorial into SwiftUI
Apple's Tutorial "CPU-GPU-Synchronization.xcodeproj" is readily available so I won't post any part of it. It is a stand-alone app that I want to launch from my SwiftUI app in some-or-any view. In "developer.apple.com/forums/thread/119112" a "Graphics and Games Engineer " kindly posted the code for creating the Coordinator, device, CommandQueue, etc. within SwiftUI code. What code/syntax is needed in either the objc tutorial code or the SwiftUI code to get the tutorial app to draw into the SwiftUI-created space? Or am I making this more complicated than it should be? I have tried creating a class in Swift with the Swift UIRepresentable as a var, then preface that class with "@objc" which should have made it available to the tutorial code, but it doesn't recognize it.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to Integrate Metal/ObjC Tutorial into SwiftUI
I modified the "Graphics and Games Engineer " code thus; struct MetalView: UIViewRepresentable {     func makeCoordinator() - Coordinator {         Coordinator(self)     }     func makeUIView(context: UIViewRepresentableContextMetalView) - MTKView {         let renderer = Renderer() //. Renderer() is from Apple's Tutorial "CPU-GPU-Synchronization.xcodeproj"         let mtkView = MTKView() //        mtkView.delegate = context.coordinator         mtkView.delegate = renderer     //  if this is the last edit, compiles but gives white screen         mtkView.preferredFramesPerSecond = 60         mtkView.enableSetNeedsDisplay = true // if let metalDevice = MTLCreateSystemDefaultDevice() { // mtkView.device = metalDevice // } if let metalDevice = renderer._device { mtkView.device = metalDevice } ... line 18 gives: "Value of type 'Renderer' has no member '_device' " and so I am stuck. I had programmed the first 128K Mac using C, when its native language was Pascal. However, I had never used ObjectiveC until now and the syntax foils me. If an ObjC @implementation is as a Swift class, then why isn't _device a member?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to SwiftUI SceneKit populated but not displayed
Not sure why it is working now, but here is what I did: First, I moved all scene initializing code into ContentView{},i.e., all node creation AND then included token nodes having drawn content (something to see). Secondly, it seems .temporalAntialiasingEnabled was/is incompatible with the simulated device of choice, so I removed it. Hope this helps.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to App does not use my permissions to create dir
I have discovered an error that functioned in macOS but does not in iOS. Specifically, all the "atPath:" 's above are fed ".absoluteString" which must be ".path" in iOS. Correcting this eliminated the debugger statement: "Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file" Thanks to Leo Dabus Nov 23 '20 at 3:53 @ stackoverflow.com for pointing out the different results of each.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’21