@Binding is not the right property wrapper to declare an ObservableObject inside a View. Use @ObservedObject or @StateObject to do that.
@Binding is used for value type variables.
see
https://www.hackingwithswift.com/quick-start/swiftui/all-swiftui-property-wrappers-explained-and-compared
Post
Replies
Boosts
Views
Activity
You could try to use SwiftUI's Canvas View for drawing your maze instead of drawing separate views für each element.
The Open Source Project "VirtualBuddy" on Github uses SwiftUI and Virtualization.
Now that Apple says (advertises) that it is possible to develop and publish an app on the App Store using only an iPad and Playgrounds, they should find a way to give access to the new APIs from the Playgrounds app before the release of the new OSes.
Otherwise you would need a Mac and XCode again to make sure they run on the new versions, when they are published!
RegEx and RegExBuilder support needs Swift 5.7.
Playgrounds app on the iPad currently only supports Swift 5.6.
Therefore it is not enough to have iPadOS 16 beta installed on the iPad you would need a new version of Playgrounds app too.
Unfortunately this newer version often comes very late in the year, usually only after the new macOS version ships (in oct or nov) and in the last years there was no Testflight beta for the app.
I observed something similar trying to put a NavigationSplitView inside a NavigationStack.
Let's hope this is a beta (1) problem and perhaps there is even a beta 2 today with improvements.
Does anyone know if this setup should work?
You need to create a detached Task in compute: https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html#ID643
Because LazyHStack can't know it's ideal size without generating (not lazyly) all of its children, therefore defeating its original purpose.
So it has to choose a fixed height?
From the SF Symbols web page:
All SF Symbols shall be considered to be system-provided images as defined in the Xcode and Apple SDKs license agreements and are subject to the terms and conditions set forth therein. You may not use SF Symbols — or glyphs that are substantially or confusingly similar — in your app icons, logos, or any other trademark-related use. Apple reserves the right to review and, in its sole discretion, require modification or discontinuance of use of any Symbol used in violation of the foregoing restrictions, and you agree to promptly comply with any such request.
Especially the symbols marked with the little i in the circle (i) are restricted.
I can not find your quoted code private var player: AVPlayer { AVPlayer.sharedDingPlayer } in the Project Files.
Did you mean private var player: AVPlayer = { AVPlayer.sharedDingPlayer }() ?
This initialises the playervariable of Type AVPlayer with the result of the provided closure, which simply returns AVPlayer.sharedDingPlayer while leaving out the not needed return statement.
You have to hold on to the cancellable as long as you want to receive the published values. In your code the cancellable is released as soon as the func applicationDidFinishLaunching finishes and no updates are send any more.
swiftpm file is the default format used by Playgrounds 4 app for iPad when choosing the "app" template when starting a new playground.
Perhaps I don't understand your problem, but where do you see a memory leak?
The SwiftUI „runtime“ is keeping the StateObject alive. That's an intended function.
SwiftUI's ViewBuilder is currently still limited to 10 views inside another view. If you want to put more views inside you have to group them using Group:
View1{
Group{
Subview1()
...
SubView10()
}
Group{
Subview11()
...
Subview20()
}
}
Mixing C++ and Swift or SwiftUI code in the same file is not yet supported.
You can probably mix them in the same project by using C oder Objective-C files for bridging but I am not expert on this topic.