NSCoder crash on decodeBool forKey (Xcode 8, Swift 3)
<p>I have this simple class</p>

<pre><code>import UIKit

class SimpleModel: NSObject, NSCoding {

    var name : String!
    var done : Bool!

    init(name:String) {
        self.name = name
        self.done = false
    }

    internal required init?(coder aDecoder: NSCoder) {
        self.name = aDecoder.decodeObject(forKey: "name") as! String
        self.done = aDecoder.decodeBool(forKey: "done") // BUG HERE
    }

    func encode(with encoder: NSCoder) {
        encoder.encode(self.name, forKey: "name")
        encoder.encode(self.done, forKey: "done")
    }
}
</code></pre>

<p>the save code:</p>

<pre><code>let data = NSKeyedArchiver.archivedData(withRootObject: storageArray)
UserDefaults.standard.set(data, forKey: "storage")
UserDefaults.standard.synchronize()
</code></pre>

<p>the read code:</p>

<pre><code>if let data = UserDefaults.standard.data(forKey: "storage") {
    storageArray = NSKeyedUnarchiver.unarchiveObject(with: data) as! [SimpleModel]
}
</code></pre>

<p>the problem occurs when the NSKeyedUnarchiver does it's job. I can not understand where the problem comes from.</p>

<p>Thanks!</p>