QMUIOrderedDictionary

@interface QMUIOrderedDictionary<__covariant KeyType, __covariant ObjectType>
    : NSObject

一个简单实现的有序的 key-value 容器,通过 initWithKeysAndObjects: 初始化后,用下标访问即可,如 dict[0] 或 dict[key]

  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithKeysAndObjects:(id)firstKey,...;
  • Undocumented

    Declaration

    Objective-C

    @property(readonly) NSUInteger count

    Swift

    var count: UInt { get }
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, copy, readonly) NSArray<KeyType> *allKeys

    Swift

    var allKeys: [KeyType] { get }
  • Undocumented

    Declaration

    Objective-C

    - (void)setObject:(ObjectType)object forKey:(KeyType)key;

    Swift

    func setObject(_ object: ObjectType, forKey key: KeyType)
  • Undocumented

    Declaration

    Objective-C

    - (void)addObject:(ObjectType)object forKey:(KeyType)key;

    Swift

    func add(_ object: ObjectType, forKey key: KeyType)
  • Undocumented

    Declaration

    Objective-C

    - (void)addObjects:(NSArray<ObjectType> *)objects forKeys:(NSArray<KeyType> *)keys;

    Swift

    func add(_ objects: [ObjectType], forKeys keys: [KeyType])
  • Undocumented

    Declaration

    Objective-C

    - (void)insertObject:(ObjectType)object forKey:(KeyType)key atIndex:(NSInteger)index;

    Swift

    func insert(_ object: ObjectType, forKey key: KeyType, at index: Int)
  • Undocumented

    Declaration

    Objective-C

    - (void)insertObjects:(NSArray<ObjectType> *)objects forKeys:(NSArray<KeyType> *)keys atIndex:(NSInteger)index;

    Swift

    func insert(_ objects: [ObjectType], forKeys keys: [KeyType], at index: Int)
  • Undocumented

    Declaration

    Objective-C

    - (void)removeObject:(ObjectType)object forKey:(KeyType)key;

    Swift

    func remove(_ object: ObjectType, forKey key: KeyType)
  • Undocumented

    Declaration

    Objective-C

    - (void)removeObject:(ObjectType)object atIndex:(NSInteger)index;

    Swift

    func remove(_ object: ObjectType, at index: Int)
  • Undocumented

    Declaration

    Objective-C

    - (nullable ObjectType)objectForKey:(KeyType)key;

    Swift

    func object(forKey key: KeyType) -> ObjectType?
  • Undocumented

    Declaration

    Objective-C

    - (ObjectType)objectAtIndex:(NSInteger)index;

    Swift

    func object(at index: Int) -> ObjectType
  • Undocumented

    Declaration

    Objective-C

    - (nullable ObjectType)objectForKeyedSubscript:(KeyType)key;

    Swift

    subscript(key: KeyType) -> ObjectType? { get }
  • Undocumented

    Declaration

    Objective-C

    - (ObjectType)objectAtIndexedSubscript:(NSUInteger)idx;

    Swift

    subscript(idx: UInt) -> ObjectType { get }