I participate in the Catalina and Xcode beta test program.
Some weeks ago, I was working with a simple macOS Cocoa/SwiftUI app (not smartphone as most users do). Yesterday it just stopped working and crashed instead. This can of course happen for a beta tester, but I am a bit surprised and annoyed about this, because it prevents me for going on. And I don't understand why it suddenly just don't work anymore.
To go more into detailed. The error is very easy to reproduce:
- Create a new Cocoa/SwiftUI project
- Add a @State variable to the ContentView
- Add a Toggle view to the ContentView's body
- Bind the @State variable to the Toggle
- Run
It then crashes immediately (not when clicking the Toggle, but when run).
Hope someone can verified this for me. Especially that it is not a fault on my installation/system, but in the latest beta software.
I am running Xcode Version: 11.0 beta 2 (11M337n). And Catalina version 10.15 Beta (19A501i).
To solve the problem, I have tried to clean the build folders.
The code below produces the error, although not using a Toggle, but a TabbedView.
import SwiftUI
struct ContentView : View
{
@State var selection: Int = 1
var body: some View
{
TabbedView(selection: $selection)
{
Text("Tab 1!").tabItemLabel(Text("Tab 1")).tag(1)
Text("Tab 2!").tabItemLabel(Text("Tab 2")).tag(2)
}
}
}
Log in output window when it crash:
dyld: lazy symbol binding failed: Symbol not found: _$s7SwiftUI5StateV13delegateValueAA7BindingVyxGvg Referenced from: /Users/asl/Library/Developer/Xcode/DerivedData/aaa-byucivzkosyehgdhjnjxicgrjnbi/Build/Products/Debug/aaa.app/Contents/MacOS/aaa Expected in: /System/Library/Frameworks/SwiftUI.framework/Versions/A/SwiftUI
dyld: Symbol not found: _$s7SwiftUI5StateV13delegateValueAA7BindingVyxGvg Referenced from: /Users/asl/Library/Developer/Xcode/DerivedData/aaa-byucivzkosyehgdhjnjxicgrjnbi/Build/Products/Debug/aaa.app/Contents/MacOS/aaa Expected in: /System/Library/Frameworks/SwiftUI.framework/Versions/A/SwiftUI