Reputation: 164301
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 ?
Upvotes: 9
Views: 1955
Reputation: 4843
As of Xcode 6.0 Beta 5, exceptions will now show up with an error marker in the source editor and in the result sidebar. If you press the quicklook button in the result sidebar we will show you the full backtrace of the exception.
Upvotes: 4
Reputation: 21845
Click the Assistant Editor icon to open the Console Output panel.
The error is listed there.
Upvotes: 6