RawOptionSetType

protocol RawOptionSetType

Protocol for NS_OPTIONS imported from Objective-C

Inheritance BitwiseOperationsType, Equatable, NilLiteralConvertible, RawRepresentable, _RawOptionSetType View Protocol Hierarchy →
Associated Types
RawValue

The "raw" type that can be used to represent all values of Self.

Every distinct value of self has a corresponding unique value of RawValue, but RawValue may have representations that do not correspond to an value of Self.

Import import Swift

Initializers

init(nilLiteral:) Required

Create an instance initialized with nil.

Declaration

init(nilLiteral: ())

Declared In

NilLiteralConvertible
init?(rawValue:) Required

Convert from a value of RawValue, yielding nil iff rawValue does not correspond to a value of Self.

Declaration

init?(rawValue: RawValue)

Declared In

RawRepresentable
init(rawValue:) Required

Declaration

init(rawValue: RawValue)

Declared In

_RawOptionSetType

Static Variables

static var allZeros: Self Required

The empty bitset.

Also the identity element for | and ^, and the fixed point for &.

Declaration

static var allZeros: Self { get }

Declared In

BitwiseOperationsType

Instance Variables

var rawValue: RawValue Required

The corresponding value of the "raw" type.

Self(rawValue: self.rawValue)! is equivalent to self.

Declaration

var rawValue: RawValue { get }

Declared In

RawRepresentable

Instance Methods

func &(_:rhs:) Required

Returns the intersection of bits set in lhs and rhs.

Complexity: O(1)

Declaration

func &(lhs: Self, rhs: Self) -> Self

Declared In

BitwiseOperationsType
func ==(_:rhs:) Required

Return true if lhs is equal to rhs.

Equality implies substitutability. When x == y, x and y are interchangeable in any code that only depends on their values.

Class instance identity as distinguished by triple-equals === is notably not part of an instance's value. Exposing other non-value aspects of Equatable types is discouraged, and any that are exposed should be explicitly pointed out in documentation.

Equality is an equivalence relation

  • x == x is true
  • x == y implies y == x
  • x == y and y == z implies x == z

Inequality is the inverse of equality, i.e. !(x == y) iff x != y

Declaration

func ==(lhs: Self, rhs: Self) -> Bool

Declared In

Equatable
func ^(_:rhs:) Required

Returns the bits that are set in exactly one of lhs and rhs

Complexity: O(1)

Declaration

func ^(lhs: Self, rhs: Self) -> Self

Declared In

BitwiseOperationsType
func |(_:rhs:) Required

Returns the union of bits set in lhs and rhs

Complexity: O(1)

Declaration

func |(lhs: Self, rhs: Self) -> Self

Declared In

BitwiseOperationsType
prefix func ~(_:) Required

Returns x ^ ~Self.allZeros

Complexity: O(1)

Declaration

prefix func ~(x: Self) -> Self

Declared In

BitwiseOperationsType