我想這在iOS的操場刪除成員在Xcode中8,但它不工作:如何從OptionSet
struct Direction: OptionSet {
let rawValue: UInt8
static let none = Direction(rawValue: 0)
static let up = Direction(rawValue: 1 << 0)
static let left = Direction(rawValue: 1 << 1)
static let down = Direction(rawValue: 1 << 2)
static let right = Direction(rawValue: 1 << 3)
static let all = [up, left, down, right]
}
var directions = Direction.all
directions.remove(.up) // Error: Missing argument label 'at:' in call
Apple's documentation表明,我應該能夠
」。 ..從自定義選項 設置類型的實例中添加或刪除成員。「
該文檔涉及remove()
函數,但這不起作用。我究竟做錯了什麼?