FWArrayWrapper

@interface FWArrayWrapper<__covariant ObjectType> : FWObjectWrapper

Undocumented

FWSafeType

  • 安全获取对象

    Declaration

    Objective-C

    - (nullable ObjectType)objectAtIndex:(NSInteger)index;

    Parameters

    index

    索引

    Return Value

    对象

  • 安全获取子数组

    Declaration

    Objective-C

    - (nullable NSArray<ObjectType> *)subarrayWithRange:(NSRange)range;

    Parameters

    range

    范围

    Return Value

    对象数组

FWFoundation

  • 过滤数组元素,返回YES的obj重新组装成一个数组

    Declaration

    Objective-C

    - (nonnull NSArray<ObjectType> *)filterWithBlock:
        (nonnull BOOL (^)(ObjectType _Nonnull))block;
  • 映射数组元素,返回的obj重新组装成一个数组

    Declaration

    Objective-C

    - (nonnull NSArray *)mapWithBlock:
        (nonnull id _Nullable (^)(ObjectType _Nonnull))block;
  • 匹配数组第一个元素,返回满足条件的第一个obj

    Declaration

    Objective-C

    - (nullable ObjectType)matchWithBlock:
        (nonnull BOOL (^)(ObjectType _Nonnull))block;
  • 从数组中随机取出对象,如@[@“a”, @“b”, @“c”]随机取出@“b”

    Declaration

    Objective-C

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