CommonValue
public enum CommonValue<T> : Equatable where T : Equatable
Indicates the state of a property that is common to multiple entities. Useful in modeling
multi-select
for user interface controls such as list views, multi-state checkboxes, etc.
-
Undocumented
Declaration
Swift
case none -
Undocumented
Declaration
Swift
case one(T) -
Undocumented
Declaration
Swift
case multi -
Returns the single value if there is one, or the given default value in the .none or .multi cases.
Declaration
Swift
public func orDefault(_ defaultValue: T) -> T -
Returns the single value if there is one, or nil in the .none or .multi cases.
Declaration
Swift
public func orNil() -> T? -
Returns the given value in the .multi case, otherwise returns nil.
Declaration
Swift
public func whenMulti<U>(_ value: U) -> U? -
Returns the given value in the .multi case, otherwise returns the alternate value.
Declaration
Swift
public func whenMulti<U>(_ value: U, otherwise: U) -> U
-
Returns true if all items share the given value.
Declaration
Swift
public func all(_ value: T) -> Bool
-
Returns the CommonValue that would result if the given value was added to the current one.
Declaration
Swift
public func adding(_ value: T) -> CommonValue<T>
CommonValue Enumeration Reference