NSDictionary(FWSafeType)

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

/**
 安全读取对象(过滤NSNull)
 
 @param key 键名
 @return 键值
 */
- (nullable ObjectType)fw_objectForKey:(nullable KeyType)key NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 安全读取对象(过滤NSNull)

    Declaration

    Objective-C

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

    Parameters

    key

    键名

    Return Value

    键值

NSDictionary+FWFoundation

  • 过滤字典元素,如果block返回NO,则去掉该元素

    Declaration

    Objective-C

    - (nonnull NSDictionary<KeyType, ObjectType> *)fw_filterWithBlock:
        (nonnull BOOL (^)(KeyType _Nonnull __strong,
                          ObjectType _Nonnull __strong))block;
  • 映射字典元素,返回的obj重新组装成一个字典

    Declaration

    Objective-C

    - (nonnull NSDictionary *)fw_mapWithBlock:
        (nonnull id _Nullable (^)(KeyType _Nonnull __strong,
                                  ObjectType _Nonnull __strong))block;
  • 匹配字典第一个元素,返回满足条件的第一个obj

    Declaration

    Objective-C

    - (nullable ObjectType)fw_matchWithBlock:
        (nonnull BOOL (^)(KeyType _Nonnull __strong,
                          ObjectType _Nonnull __strong))block;