Posts

Post not yet marked as solved
0 Replies
879 Views
Hi If I understood correctly, by marking the model class with @MainActor, we ensure that all method are called on the main thread. Using the async {} closure syntax to start a async task when clicking the save button will also run on the main thread. Would it be interesting and possible to use asyncDetached with a background priority? Or should we never use asyncDetached within swiftUI? Or do we reconcile asyncDetached with the @MainActor paradigm? Then, what would happen if within the fetchPhotos method, we use concurrency with async let syntax to populate downloaded variable concurrently. This could be interesting if for instance the data we download from the internet is huge and take times to be processed. Are we going to use the different cores of our Mac? Thank you Regards Vincent
Posted
by Vincou.
Last updated
.
Post not yet marked as solved
0 Replies
766 Views
I’m using SceneKit to render some spheres and cylinders so I’m using NSViewRepresentable protocol to import the SCNView to SwiftUI.Then I’m using the view as any SwiftUI view.I need to detect some gestures in order to move the camera and make my 3D objects rotate.For instance, I’m using the DragGesture to rotate the camera.What I was used to do with Storyboards is, in the NSViewControler, to detect force click and also flagsChanged to detect the press of modifier keys such as shift or control.I’m using that together with NSPanGestureRecognizer in order for instance to translate the objects instead to rotate them (if no modifier key is pressed).So my questions are:1) Is there a way to detect force click with the trackpad in SwiftUI? I haven’t found anything in the Gesture. I can use LongPressGesture but it's not the same.2) How to detect key pressed, in particular modifier keys during a Gesture is SwiftUI?Best regardsVincent
Posted
by Vincou.
Last updated
.