NSDictionary(FWFoundation)

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

/// 过滤字典元素,如果block返回NO,则去掉该元素
- (NSDictionary<KeyType, ObjectType> *)fw_filterWithBlock:(BOOL (^)(KeyType key, ObjectType obj))block NS_REFINED_FOR_SWIFT;

/// 映射字典元素,返回的obj重新组装成一个字典
- (NSDictionary *)fw_mapWithBlock:(id _Nullable (^)(KeyType key, ObjectType obj))block NS_REFINED_FOR_SWIFT;

/// 匹配字典第一个元素,返回满足条件的第一个obj
- (nullable ObjectType)fw_matchWithBlock:(BOOL (^)(KeyType key, ObjectType obj))block NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 过滤字典元素,如果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;