ObservableObject With Closure With Typed Throws Crashes on iOS 17

Having a property inside of an ObservableObject with a type of a closure with a typed throws will crash the app on the initialization of the observable object on iOS 17. Here is an example:

struct ContentView: View {
    @StateObject var myDataSource = MyDataSource()
    var body: some View {
        EmptyView()
    }
}

enum MyError: Error {
    case error
}

class MyDataSource: ObservableObject {
    let signUp: (Int) throws(MyError) -> Void = { _ in }
}

If you run this code on iOS 17, the app will crash. The Radar for this issue is FB16399987.

Answered by DTS Engineer in 822704022
Written by nmolby in 773159021
The Radar for this issue is FB16399987.

Thanks for filing that; a bug report is definitely the right path forward here.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Written by nmolby in 773159021
The Radar for this issue is FB16399987.

Thanks for filing that; a bug report is definitely the right path forward here.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

ObservableObject With Closure With Typed Throws Crashes on iOS 17
 
 
Q