I am trying to use the NSCoding protocol on a class I have written in swift, but cannot seem to figure out why the compiler complains that it \"does not conform to protocol
The parameters are not implicitly unwrapped (remove the !), and the initializer requires the required modifier:
required init(coder aDecoder: NSCoder) {
...
func encodeWithCoder(_aCoder: NSCoder) {
For Swift 3
A minor but important change has been commited . The init method is same but the encodeWithCoder method has been modified.
required init(coder aDecoder: NSCoder) {
...
}
func encode(with _aCoder: NSCoder) {
...
}