I have a struct Person extends OptionSetType. Later in code, How can I use a switch statement to check if an instance of Person is more than one value?
Thank you
struct Person: OptionSetType {
let rawValue: Int
init(rawValue: Int){
self.rawValue = rawValue
}
static let boy = Person(rawValue: 1 << 0)
static let young = Person(rawValue: 1 << 1)
static let smart = Person(rawValue: 1 << 2)
static let strong = Person(rawValue: 1 << 3)
}
//later declared
var him: Person!
//later initialised
him = [.boy, .young]
//now test using a switch block
Switch (him) {
case .boy & .young // <----- How do you get this to work?
}
How would test for him == young and strong?
How to test him contains young and boy?