Smoothie
04/14/2025, 3:20 PMdo {
//try Library.companion.getData()
throw SealedClass.NotInitialized().asError()
}
catch let error as SealedClass {
print("SealedClass")
}
catch let error as SealedClass.NotInitialized {
print("NotInitialized")
}
catch let error {
print("It's another type\(error)")
}
ephemient
04/14/2025, 4:35 PMNSError
to be thrown to ObjC (which Swift handles as Error
). you can unwrap with the extension
do {
//try Library.companion.getData()
throw SealedClass.NotInitialized().asError()
} catch error {
switch error.kotlinException {
case as SealedClass.NotInitialized:
print("NotInitialized")
case as SealedClass:
print("SealedClass")
default:
print("It's another type\(error)")
}
}