FunkyPair

@interface FunkyPair < __covariant KeyType : id <NSCopying>
, __covariant ObjectType > : NSObject @end

This is a data structure representing a key-value pair

  • key

    The identifier of the stored value

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) KeyType key;

    Swift

    var key: KeyType! { get set }
  • The value belonging to the given key

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) ObjectType value;

    Swift

    var value: ObjectType! { get set }
  • Creates a new pair structure given the key and the value parameters

    Declaration

    Objective-C

    + (instancetype)pairWithKey:(KeyType)key value:(ObjectType)value;

    Swift

    convenience init!(key: KeyType!, value: ObjectType!)

    Parameters

    key

    The identifier

    value

    The stored value

    Return Value

    A new pair structure with the given key and value

  • Creates a new pair structure with the same value but with a new key

    Declaration

    Objective-C

    - (FunkyPair *)pairByModifyingKey:(KeyType)key;

    Swift

    func modifyingKey(_ key: KeyType!) -> FunkyPair

    Parameters

    key

    The new identifier to use for the value

    Return Value

    A new pair structure with the given the new key

  • Creates a new pair structure with the same key but with a new value

    Declaration

    Objective-C

    - (FunkyPair *)pairByModifyingValue:(ObjectType)value;

    Swift

    func modifyingValue(_ value: ObjectType!) -> FunkyPair

    Parameters

    value

    The new value to use for the key

    Return Value

    A new pair structure with the given the new value