Question for iOS Swift guys:

Since Implicitly Unwrapped Optionals are now dropped for a while, and everything is an optional, hiw can I now declare property that has no value and intializer will not make fuss?

I used to do this:

class Bullet {
var calibre: Double!

This way I can avoid initializer which gets useful when there are properties which hold complex types, which get useful when writing tests.

If I remove ! Then compiler complains.
If I put ? Then My code becomes crap of guards and ifs to check for optionals.

Really hate this Optional thing in Swift. Half my time when I jave an issue is related to optionals.

let x: Int! = 10
let y = x, yields y: Int?

Add Comment