I'm having trouble finding the correct way to conform the the NSSecureCoding
protocol in Swift, specifically when decoding objects that is an array of other objects.
I can't create an NSSet
of class types in swift.
In Objective-C I would use
self.books = [aDecoder decodeObjectOfClasses:[NSSet setWithObjects:[NSArray class], [Book class], nil] forKey:@"books"];
in Swift I'm having issues creating the NSSet
like this :
self.books = aDecoder.decodeObjectOfClasses(NSSet().setByAddingObject(NSArray.self).setByAddingObject(Book.self), forKey:"books")
Here's the error:
Type 'NSArray.Type' does not conform to protocol 'AnyObject'