I was playing around with Swift, and have this code in a playground
class Foo {
let value: String
init(value: String!)
{
self.value = value
}
}
let x : String? = nil
let foo = Foo(value: x)
The bottom line should throw an exception in the initializer, because I am unwrapping x
which is nil. However I am not able to see the exception message or the fact that an error happens at runtime. If I add code below this, it does not get run (no output gets shown).
How can I see the exceptions that are thrown at runtime in a Swift playground ?