icekomo
icekomo

Reputation: 9466

warning : will never be excuted

I updated an old Swift 1 app to Swift 2 using Xcode 7 and I'm getting a few warnings that were not there before I updated.

 required init(coder aDecoder: NSCoder) {

    fatalError("init(coder:) has not been implemented")

    // SWIFT 2 update
    state = .OptionsVisible
    super.init(coder: aDecoder)!
}

That function is giving me 2 warnings that both the state and the super lines will not be executed, but I'm not sure why? I figured something changed between Swift 1 and 2, but I'm not really sure what.

Thanks!

Upvotes: 0

Views: 151

Answers (1)

David Berry
David Berry

Reputation: 41226

fatalError is now flagged as @noreturn, so the compiler can tell that nothing after that will be executed.

Upvotes: 3

Related Questions