I have been experiencing a problem that I can't seem to figure out how it's happening or how to fix it.
When then view below appears, the app crashes and shows this message:
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1a2120fac)
If I remove the line that sets color to nil the view appears without any crashes.
I have looked up the error and worked out its about nil and optionals, but I don't know why setting the variable to nil doesn't work.
Has anyone got any ideas as to why this is happening and how to fix it?
Thanks is advance.
When then view below appears, the app crashes and shows this message:
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1a2120fac)
If I remove the line that sets color to nil the view appears without any crashes.
Code Block Swift ... @Binding var color: Color? var body: some View { NavigationView { ... } .onAppear { switch background { case .color: color = nil // error not occurring when this line removed ... } } }
I have looked up the error and worked out its about nil and optionals, but I don't know why setting the variable to nil doesn't work.
Has anyone got any ideas as to why this is happening and how to fix it?
Thanks is advance.