I have a class called Option. This is a Realm object, so it is a subclass of the Realm native base class Object.
In the view controller, I have an array property that contains a bunch of objects Option.
private var options = [Option]()
In the view controller's down method, I need to check if a specific object is contained in the above parameter array Option.
Earlier (Swift 1.2) I have validation logic like this.
func itemSelected(selection: Object) {
let option = selection as! Option
if !contains(options, option) {
}
}
Now I am converting the project to Swift 2 (I also upgraded the version of Realm to the version of Swift 2). I updated the code before that.
func itemSelected(selection: Object) {
let option = selection as! Option
if !options.contains(option) {
}
}
But now I get the following compilation error!
'Option' '@noescape (Option) throws → Bool'
, . ?