NSDictionary(FWApplication)

@interface NSDictionary <__covariant KeyType,
                         __covariant ObjectType>(FWApplication)

NSDictionary分类

  • 从字典中随机取出Key,如@{@“a”=>@2, @“b”=>@8, @“c”=>@0}随机取出@“b”

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) KeyType fw_randomKey;

    Return Value

    随机Key

  • 从字典中随机取出对象,如@{@“a”=>@2, @“b”=>@8, @“c”=>@0}随机取出@8

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) ObjectType fw_randomObject;

    Return Value

    随机对象

  • 从字典中按权重Object随机取出Key,如@{@“a”=>@2, @“b”=>@8, @“c”=>@0}大概率取出@“b",不会取出@"c”

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) KeyType fw_randomWeightKey;

    Return Value

    随机Key

  • 字典中是否含有NSNull值

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL fw_includeNull;

    Return Value

    是否含有NSNull

  • 递归移除字典中NSNull值

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NS_REFINED_FOR_SWIFT NSDictionary<KeyType, ObjectType> *fw_removeNull;

    Return Value

    不含NSNull的字典

  • 移除字典中NSNull值

    @praram recursive 是否递归

    Declaration

    Objective-C

    - (nonnull NSDictionary<KeyType, ObjectType> *)fw_removeNullRecursive:
        (BOOL)recursive;

    Return Value

    不含NSNull的字典