Classes

The following classes are available globally.

FWLayoutChain

  • 视图链式布局类

    Note

    如果约束条件完全相同,会自动更新约束而不是重新添加。 另外,默认布局方式使用LTR,如果需要RTL布局,可通过fwAutoLayoutRTL统一启用
    See more

    Declaration

    Objective-C

    
    @interface FWLayoutChain : NSObject

FWAutoloader

FWLocationManager

  • 位置服务

    Note

    注意:Info.plist需要添加NSLocationWhenInUseUsageDescription项 如果请求Always定位,还需添加NSLocationAlwaysUsageDescription项和NSLocationAlwaysAndWhenInUseUsageDescription项 iOS11可通过showsBackgroundLocationIndicator配置是否显示后台定位指示器
    See more

    Declaration

    Objective-C

    
    @interface FWLocationManager : NSObject

FWLogger

  • 日志记录类。支持设置全局日志级别和自定义FWLoggerPlugin插件

    See more

    Declaration

    Objective-C

    
    @interface FWLogger : NSObject

FWLoggerPluginImpl

FWMediator

FWModuleBundle

  • 业务模块Bundle基类,各模块可继承

    See more

    Declaration

    Objective-C

    
    @interface FWModuleBundle : NSObject

FWPluginManager

  • 插件管理器类。支持插件冷替换(使用插件前)和热替换(先释放插件)

    Note

    和Mediator对比如下: Plugin:和业务无关,侧重于工具类、基础设施、可替换,比如Toast、Loading等 Mediator: 和业务相关,侧重于架构、业务功能、模块化,比如用户模块,订单模块等
    See more

    Declaration

    Objective-C

    
    @interface FWPluginManager : NSObject

FWWeakProxy

  • 弱引用代理类,用于解决NSTimer和CADisplayLink中的循环引用target问题(默认NSTimer会强引用target,直到invalidate)

    See more

    Declaration

    Objective-C

    
    @interface FWWeakProxy : NSProxy

FWWeakObject

  • 弱引用对象容器类,用于解决关联对象weak引用等

    See more

    Declaration

    Objective-C

    
    @interface FWWeakObject : NSObject

FWBlockProxy

FWDelegateProxy

  • 事件协议代理基类,可继承重写事件代理方法

    See more

    Declaration

    Objective-C

    
    @interface FWDelegateProxy : NSObject

FWMulticastDelegate

FWRouterContext

  • URL路由上下文

    See more

    Declaration

    Objective-C

    
    @interface FWRouterContext : NSObject <NSCopying>

FWRouter

FWState

  • 状态类

    See more

    Declaration

    Objective-C

    
    @interface FWState : NSObject

FWStateEvent

FWStateTransition

FWStateMachine

FWTask

  • 任务基类

    See more

    Declaration

    Objective-C

    
    @interface FWTask : NSOperation

FWTaskManager

  • 任务管理器,兼容NSBlockOperation和NSInvocationOperation

    See more

    Declaration

    Objective-C

    
    @interface FWTaskManager : NSObject

FWThemeManager

  • 主题管理器,iOS13+可跟随系统改变

    Note

    框架默认只拦截了UIView|UIViewController|UIScreen|UIImageView|UILabel类,满足条件会自动触发fwThemeChanged;如果不满足条件或者拦截未生效,需先设置主题上下文fwThemeContext才能生效 注意事项:iOS13以下默认不支持主题切换;如需支持,请使用fwColor相关方法
    See more

    Declaration

    Objective-C

    
    @interface FWThemeManager : NSObject
  • 主题动态对象,可获取当前主题静态对象

    See more

    Declaration

    Objective-C

    
    @interface FWThemeObject<__covariant ObjectType> : NSObject
  • FWAlertController样式,继承自FWAlertAppearance

    See more

    Declaration

    Objective-C

    
    @interface FWAlertControllerAppearance : FWAlertAppearance
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWAlertAction : NSObject <NSCopying>
    
    + (instancetype)actionWithTitle:(nullable NSString *)title style:(FWAlertActionStyle)style handler:(void (^ __nullable)(FWAlertAction *action))handler;
    + (instancetype)actionWithTitle:(nullable NSString *)title style:(FWAlertActionStyle)style appearance:(nullable FWAlertControllerAppearance *)appearance handler:(void (^ __nullable)(FWAlertAction *action))handler;
    
    /** action的标题 */
    @property(nullable, nonatomic, copy) NSString *title;
    /** action的富文本标题 */
    @property(nullable, nonatomic, copy) NSAttributedString *attributedTitle;
    /** action的图标,位于title的左边 */
    @property(nullable, nonatomic, copy) UIImage *image;
    /** title跟image之间的间距 */
    @property (nonatomic, assign) CGFloat imageTitleSpacing;
    /** 渲染颜色,当外部的图片使用了UIImageRenderingModeAlwaysTemplate时,使用该属性可改变图片的颜色 */
    @property (nonatomic, strong) UIColor *tintColor;
    /** 是否能点击,默认为YES */
    @property(nonatomic, getter=isEnabled) BOOL enabled;
    /** action的标题颜色,这个颜色只是普通文本的颜色,富文本颜色需要用NSForegroundColorAttributeName */
    @property(nonatomic, strong) UIColor *titleColor;
    /** action的标题字体,如果文字太长显示不全,会自动改变字体自适应按钮宽度,最多压缩文字为原来的0.5倍封顶 */
    @property(nonatomic, strong) UIFont *titleFont;
    /** action的标题的内边距,如果在不改变字体的情况下想增大action的高度,可以设置该属性的top和bottom值,默认UIEdgeInsetsMake(0, 15, 0, 15) */
    @property(nonatomic, assign) UIEdgeInsets titleEdgeInsets;
    
    /** 样式 */
    @property(nonatomic, readonly) FWAlertActionStyle style;
    /** 自定义样式,默认为样式单例 */
    @property (nonatomic, strong, readonly) FWAlertControllerAppearance *alertAppearance;
    
    @end
  • Declaration

    Objective-C

    
    @interface FWAlertController : UIViewController
  • Undocumented

    Declaration

    Objective-C

    @interface FWAlertPresentationController : UIPresentationController
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWAlertAnimation : NSObject <UIViewControllerAnimatedTransitioning>
    + (instancetype)animationIsPresenting:(BOOL)presenting;
    @end

FWAlertControllerImpl

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWAlertControllerImpl : NSObject <FWAlertPlugin>
    
    /** 单例模式 */
    @property (class, nonatomic, readonly) FWAlertControllerImpl *sharedInstance;
    
    /// 自定义Alert弹窗样式,nil时使用单例
    @property (nonatomic, strong, nullable) FWAlertControllerAppearance *customAlertAppearance;
    
    /// 自定义ActionSheet弹窗样式,nil时使用单例
    @property (nonatomic, strong, nullable) FWAlertControllerAppearance *customSheetAppearance;
    
    /// 点击暗色背景关闭时是否触发cancelBlock,默认NO
    @property (nonatomic, assign) BOOL dimmingTriggerCancel;
    
    /// 弹窗自定义句柄,show方法自动调用
    @property (nonatomic, copy, nullable) void (^customBlock)(FWAlertController *alertController);
    
    /// 显示自定义视图弹窗,无默认按钮
    - (void)viewController:(UIViewController *)viewController
        showAlertWithStyle:(UIAlertControllerStyle)style
                headerView:(UIView *)headerView
                    cancel:(nullable id)cancel
                   actions:(nullable NSArray *)actions
               actionBlock:(nullable void (^)(NSInteger index))actionBlock
               cancelBlock:(nullable void (^)(void))cancelBlock
               customBlock:(nullable void (^)(id alertController))customBlock;
    
    @end

FWAlertAppearance

  • 系统弹出框样式配置类,由于系统兼容性,建议优先使用FWAlertController

    Note

    如果未自定义样式,显示效果和系统一致,不会产生任何影响;框架会先渲染actions动作再渲染cancel动作
    See more

    Declaration

    Objective-C

    
    @interface FWAlertAppearance : NSObject

FWAlertPluginImpl

FWImageFrame

  • 动图单帧对象

    See more

    Declaration

    Objective-C

    
    @interface FWImageFrame : NSObject

FWImageCoder

  • 图片解码器,支持动图

    See more

    Declaration

    Objective-C

    
    @interface FWImageCoder : NSObject
  • 框架内置应用Bundle类,应用可替换

    Note

    如果主应用存在FWApplication.bundle或主Bundle内包含对应图片|多语言,则优先使用;否则使用框架默认实现。 FWApplication所需本地化翻译如下:完成|关闭|确定|取消|原有,配置同App本地化一致即可,如zh-Hans|en等
    See more

    Declaration

    Objective-C

    
    @interface FWAppBundle : FWModuleBundle
  • 框架内置应用配置默认模板类

    Declaration

    Objective-C

    
    @interface FWAppConfigDefaultTemplate
        : NSObject <FWConfigurationTemplateProtocol>
  • AppDelegate基类

    See more

    Declaration

    Objective-C

    
    @interface FWAppDelegate : UIResponder <UIApplicationDelegate>

FWAsset

  • 相册里某一个资源的包装对象,该资源可能是图片、视频等。

    Note

    FWAsset 重写了 isEqual: 方法,只要两个 FWAsset 的 identifier 相同,则认为是同一个对象,以方便在数组、字典等容器中对大量 FWAsset 进行遍历查找等操作。
    See more

    Declaration

    Objective-C

    
    @interface FWAsset : NSObject

FWAssetGroup

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWAssetGroup : NSObject
    
    - (instancetype)initWithPHCollection:(PHAssetCollection *)phAssetCollection;
    
    - (instancetype)initWithPHCollection:(PHAssetCollection *)phAssetCollection fetchAssetsOptions:(nullable PHFetchOptions *)pHFetchOptions;
    
    /// 仅能通过 initWithPHCollection 和 initWithPHCollection:fetchAssetsOption 方法修改 phAssetCollection 的值
    @property(nonatomic, strong, readonly) PHAssetCollection *phAssetCollection;
    
    /// 仅能通过 initWithPHCollection 和 initWithPHCollection:fetchAssetsOption 方法修改 phAssetCollection 后,产生一个对应的 PHAssetsFetchResults 保存到 phFetchResult 中
    @property(nonatomic, strong, readonly) PHFetchResult *phFetchResult;
    
    /// 相册的名称
    - (nullable NSString *)name;
    
    /// 相册内的资源数量,包括视频、图片、音频(如果支持)这些类型的所有资源
    - (NSInteger)numberOfAssets;
    
    /**
     *  相册的缩略图,即系统接口中的相册海报(Poster Image)
     *
     *  @return 相册的缩略图
     */
    - (nullable UIImage *)posterImageWithSize:(CGSize)size;
    
    /**
     *  枚举相册内所有的资源
     *
     *  @param albumSortType    相册内资源的排序方式,可以选择日期最新的排在最前面,也可以选择日期最新的排在最后面
     *  @param enumerationBlock 枚举相册内资源时调用的 block,参数 result 表示每次枚举时对应的资源。
     *                          枚举所有资源结束后,enumerationBlock 会被再调用一次,这时 result 的值为 nil。
     *                          可以以此作为判断枚举结束的标记
     */
    - (void)enumerateAssetsWithOptions:(FWAlbumSortType)albumSortType usingBlock:(nullable void (^)(FWAsset * _Nullable resultAsset))enumerationBlock;
    
    /**
     *  枚举相册内所有的资源,相册内资源按日期最新的排在最后面
     *
     *  @param enumerationBlock 枚举相册内资源时调用的 block,参数 result 表示每次枚举时对应的资源。
     *                          枚举所有资源结束后,enumerationBlock 会被再调用一次,这时 result 的值为 nil。
     *                          可以以此作为判断枚举结束的标记
     */
    - (void)enumerateAssetsUsingBlock:(nullable void (^)(FWAsset * _Nullable result))enumerationBlock;
    
    @end

FWAssetManager

  • 构建 FWAssetManager 这个对象并提供单例的调用方式主要出于下面两点考虑:

    1. 保存照片/视频的方法较为复杂,为了方便封装系统接口,同时灵活地扩展功能,需要有一个独立对象去管理这些方法。
    2. 使用 PhotoKit 获取图片,基本都需要一个 PHCachingImageManager 的实例,为了减少消耗, FWAssetManager 单例内部也构建了一个 PHCachingImageManager,并且暴露给外面,方便获取 PHCachingImageManager 的实例。
    See more

    Declaration

    Objective-C

    
    @interface FWAssetManager : NSObject
  • The FWAsyncLayer class is a subclass of CALayer used for render contents asynchronously.

    Note

    When the layer need update it’s contents, it will ask the delegate for a async display task to render the contents in a background queue.

    See more

    Declaration

    Objective-C

    
    @interface FWAsyncLayer : CALayer
  • A display task used by FWAsyncLayer to render the contents in background queue.

    See more

    Declaration

    Objective-C

    
    @interface FWAsyncLayerDisplayTask : NSObject
  • FWSentinel is a thread safe incrementing counter. It may be used in some multi-threaded situation.

    See more

    Declaration

    Objective-C

    
    @interface FWAsyncSentinel : NSObject
  • FWTransaction let you perform a selector once before current runloop sleep.

    See more

    Declaration

    Objective-C

    
    @interface FWAsyncTransaction : NSObject
  • /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    See more

    Declaration

    Objective-C

    
    @interface FWAsyncSocket : NSObject
  • /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    See more

    Declaration

    Objective-C

    @class FWAsyncUdpSocket;

FWAttributedLabel

FWAttributedLabelURL

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWAttributedLabelURL : NSObject
    
    @property (nonatomic,strong)          id      linkData;
    @property (nonatomic,assign)          NSRange range;
    @property (nonatomic,strong,nullable) UIColor *color;
    
    + (FWAttributedLabelURL *)urlWithLinkData:(id)linkData
                                        range:(NSRange)range
                                        color:(nullable UIColor *)color;
    
    @end

FWAttributedLabelURLDetector

FWAttributedLabelAttachment

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWAttributedLabelAttachment : NSObject
    
    @property (nonatomic,strong) id                    content;
    @property (nonatomic,assign) UIEdgeInsets          margin;
    @property (nonatomic,assign) FWAttributedAlignment alignment;
    @property (nonatomic,assign) CGFloat               fontAscent;
    @property (nonatomic,assign) CGFloat               fontDescent;
    @property (nonatomic,assign) CGSize                maxSize;
    
    
    + (FWAttributedLabelAttachment *)attachmentWith:(id)content
                                             margin:(UIEdgeInsets)margin
                                          alignment:(FWAttributedAlignment)alignment
                                            maxSize:(CGSize)maxSize;
    
    - (CGSize)boxSize;
    
    @end
  • Declaration

    Objective-C

    
    @interface FWAudioPlayer : NSObject

FWBadgeView

  • 提醒灯视图,默认禁用userInteractionEnabled

    See more

    Declaration

    Objective-C

    
    @interface FWBadgeView : UIView
  • Declaration

    Objective-C

    
    @interface FWBannerView : UIView
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWBannerViewCell : UICollectionViewCell
    
    @property (nonatomic, weak, nullable) UIImageView *imageView;
    @property (nonatomic, copy, nullable) NSString *title;
    
    @property (nonatomic, strong, nullable) UIColor *titleLabelTextColor;
    @property (nonatomic, strong, nullable) UIFont *titleLabelTextFont;
    @property (nonatomic, strong, nullable) UIColor *titleLabelBackgroundColor;
    @property (nonatomic, assign) CGFloat titleLabelHeight;
    @property (nonatomic, assign) NSTextAlignment titleLabelTextAlignment;
    @property (nonatomic, assign) UIEdgeInsets contentViewInset;
    @property (nonatomic, assign) CGFloat contentViewCornerRadius;
    
    @property (nonatomic, assign) BOOL hasConfigured;
    
    /** 只展示文字轮播 */
    @property (nonatomic, assign) BOOL onlyDisplayText;
    
    @end

FWBarrageRenderView

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWBarrageRenderView : UIView <CAAnimationDelegate> {
        NSMutableArray<FWBarrageCell *> *_animatingCells;
        NSMutableArray<FWBarrageCell *> *_idleCells;
        dispatch_semaphore_t _animatingCellsLock;
        dispatch_semaphore_t _idleCellsLock;
        dispatch_semaphore_t _trackInfoLock;
        FWBarrageCell *_lastestCell;
        UIView *_lowPositionView;
        UIView *_middlePositionView;
        UIView *_highPositionView;
        UIView *_veryHighPositionView;
        BOOL _autoClear;
        FWBarrageRenderStatus _renderStatus;
        NSMutableDictionary *_trackNextAvailableTime;
    }
    
    @property (nonatomic, strong, readonly) NSMutableArray<FWBarrageCell *> *animatingCells;
    @property (nonatomic, strong, readonly) NSMutableArray<FWBarrageCell *> *idleCells;
    @property (nonatomic, assign) FWBarrageRenderPositionStyle renderPositionStyle;
    @property (nonatomic, assign, readonly) FWBarrageRenderStatus renderStatus;
    
    - (nullable FWBarrageCell *)dequeueReusableCellWithClass:(Class)barrageCellClass;
    - (void)fireBarrageCell:(FWBarrageCell *)barrageCell;
    - (BOOL)trigerActionWithPoint:(CGPoint)touchPoint;
    
    - (void)start;
    - (void)pause;
    - (void)resume;
    - (void)stop;
    
    @end

FWBarrageManager

FWBarrageDescriptor

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWBarrageDescriptor : NSObject
    
    @property (nonatomic, assign, nullable) Class barrageCellClass;
    @property (nonatomic, assign) FWBarragePositionPriority positionPriority;//显示位置normal型的渲染在low型的上面, height型的渲染在normal上面
    @property (nonatomic, assign) CGFloat animationDuration;//动画时间, 时间越长速度越慢, 时间越短速度越快
    @property (nonatomic, assign) CGFloat fixedSpeed;//固定速度, 可以防止弹幕在有空闲轨道的情况下重叠, 取值0.0~100.0, animationDuration与fixedSpeed只能选择一个, fixedSpeed设置之后可以不用设置animationDuration
    
    @property (nonatomic, copy, nullable) FWBarrageCellTouchedAction cellTouchedAction;//新属性里回传了被点击的cell, 可以在代码块里更改被点击的cell的属性, 比如之前有用户需要在弹幕被点击的时候修改被点击的弹幕的文字颜色等等. 用来替代旧版本的touchAction
    @property (nonatomic, strong, nullable) UIColor *borderColor; // Default is no border
    @property (nonatomic, assign) CGFloat borderWidth; // Default is 0
    @property (nonatomic, assign) CGFloat cornerRadius; // Default is 8
    
    @property (nonatomic, assign) NSRange renderRange;//渲染范围, 最终渲染出来的弹幕的Y坐标最小不小于renderRange.location, 最大不超过renderRange.length-barrageCell.height
    
    @end

FWBarrageCell

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWBarrageCell : UIView
    @property (nonatomic, assign, getter=isIdle) BOOL idle;//是否是空闲状态
    @property (nonatomic, assign) NSTimeInterval idleTime;//开始闲置的时间, 闲置超过5秒的, 自动回收内存
    @property (nonatomic, strong, nullable) FWBarrageDescriptor *barrageDescriptor;
    @property (nonatomic, strong, readonly, nullable) CAAnimation *barrageAnimation;
    @property (nonatomic, assign) int trackIndex;
    
    - (void)addBarrageAnimationWithDelegate:(id<CAAnimationDelegate>)animationDelegate;
    - (void)prepareForReuse;
    - (void)clearContents;
    
    - (void)updateSubviewsData;
    - (void)layoutContentSubviews;
    - (void)convertContentToImage;
    - (void)sizeToFit;//设置好数据之后调用一下自动计算bounds
    - (void)removeSubViewsAndSublayers;//默认删除所有的subview和sublayer; 如果需要选择性的删除可以重写这个方法.
    - (void)addBorderAttributes;
    
    @end

FWBarrageTextDescriptor

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWBarrageTextDescriptor : FWBarrageDescriptor {
        NSMutableDictionary *_textAttribute;
    }
    
    @property (nonatomic, strong, nullable) UIFont *textFont;
    @property (nonatomic, strong, nullable) UIColor *textColor;
    
    /*
     * 关闭文字阴影可大幅提升性能, 推荐使用strokeColor, 与shadowColor相比strokeColor性能更强悍
     */
    @property (nonatomic, assign) BOOL textShadowOpened;//默认NO
    @property (nonatomic, strong, nullable) UIColor *shadowColor;//默认黑色
    @property (nonatomic, assign) CGSize shadowOffset;//默认CGSizeZero
    @property (nonatomic, assign) CGFloat shadowRadius;//默认2.0
    @property (nonatomic, assign) CGFloat shadowOpacity;//默认0.5
    
    @property (nonatomic, strong, nullable) UIColor *strokeColor;
    @property (nonatomic, assign) int strokeWidth;//笔画宽度(粗细),取值为 NSNumber 对象(整数),负值填充效果,正值中空效果
    
    @property (nonatomic, copy, nullable) NSString *text;
    @property (nonatomic, copy, nullable) NSAttributedString *attributedText;
    
    @end

FWBarrageTextCell

FWBarrageTrackInfo

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWBarrageTrackInfo : NSObject
    
    @property (nonatomic, assign) int trackIndex;
    @property (nonatomic, copy, nullable) NSString *trackIdentifier;
    @property (nonatomic, assign) CFTimeInterval nextAvailableTime;//下次可用的时间
    @property (nonatomic, assign) NSInteger barrageCount;//当前行的弹幕数量
    @property (nonatomic, assign) CGFloat trackHeight;//轨道高度
    
    @end
  • FWBaseRequest is the abstract class of network request. It provides many options for constructing request. It’s the base class of FWRequest.

    See more

    Declaration

    Objective-C

    
    @interface FWBaseRequest : NSObject
  • FWBatchRequest can be used to batch several FWRequest. Note that when used inside FWBatchRequest, a single FWRequest will have its own callback and delegate cleared, in favor of the batch request callback.

    See more

    Declaration

    Objective-C

    
    @interface FWBatchRequest : NSObject

FWCacheEngine

FWCollectionViewSectionConfig

FWCollectionViewFlowLayout

  • 系统FlowLayout水平滚动时默认横向渲染,可通过本类开启纵向渲染 示例效果如下: [0 3 6 9 ] [0 1 2 3 ] [1 4 7 10] => [4 5 6 7 ] [2 5 8 11] [8 9 10 11]

    See more

    Declaration

    Objective-C

    
    @interface FWCollectionViewFlowLayout : UICollectionViewFlowLayout

FWCollectionViewWaterfallLayout

  • The FWCollectionViewWaterfallLayout class is a concrete layout object that organizes items into waterfall-based grids with optional header and footer views for each section.

    A waterfall layout works with the collection view’s delegate object to determine the size of items, headers, and footers in each section. That delegate object must conform to the FWCollectionViewDelegateWaterfallLayout protocol.

    Each section in a waterfall layout can have its own custom header and footer. To configure the header or footer for a view, you must configure the height of the header or footer to be non zero. You can do this by implementing the appropriate delegate methods or by assigning appropriate values to the headerHeight and footerHeight properties. If the header or footer height is 0, the corresponding view is not added to the collection view.

    Note

    FWCollectionViewWaterfallLayout doesn’t support decoration view, and it supports vertical scrolling direction only.
    See more

    Declaration

    Objective-C

    
    @interface FWCollectionViewWaterfallLayout : UICollectionViewLayout

FWCollectionViewAlignLayout

FWEmptyPluginImpl

FWEmptyView

UIScrollView+FWScrollOverlayView

  • Undocumented

    Declaration

    Objective-C

    @interface FWScrollOverlayView : UIView
    
    @end
  • 浮动布局视图

    Note

    做类似 CSS 里的 float:left 的布局,自行使用 addSubview: 将子 View 添加进来即可。 支持通过 contentMode 属性修改子 View 的对齐方式,目前仅支持 UIViewContentModeLeftUIViewContentModeRight,默认为 UIViewContentModeLeft

    See more

    Declaration

    Objective-C

    
    @interface FWFloatLayoutView : UIView
  • 网格视图

    Note

    用于做九宫格布局,会将内部所有的 subview 根据指定的列数和行高,把每个 item(也即 subview) 拉伸到相同的大小。 支持在 item 和 item 之间显示分隔线,分隔线支持虚线。 注意分隔线是占位的,把 item 隔开,而不是盖在某个 item 上。

    See more

    Declaration

    Objective-C

    
    @interface FWGridView : UIView
  • Declaration

    Objective-C

    
    @interface FWHTTPSessionManager
        : FWURLSessionManager <NSSecureCoding, NSCopying>
  • Declaration

    Objective-C

    
    @interface FWImageCropController : UIViewController
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWImageCropOverlayView : UIView
    
    /** Hides the interior grid lines, sans animation. */
    @property (nonatomic, assign) BOOL gridHidden;
    
    /** Add/Remove the interior horizontal grid lines. */
    @property (nonatomic, assign) BOOL displayHorizontalGridLines;
    
    /** Add/Remove the interior vertical grid lines. */
    @property (nonatomic, assign) BOOL displayVerticalGridLines;
    
    /** Shows and hides the interior grid lines with an optional crossfade animation. */
    - (void)setGridHidden:(BOOL)hidden animated:(BOOL)animated;
    
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWImageCropScrollView : UIScrollView
    
    @property (nullable, nonatomic, copy) void (^touchesBegan)(void);
    @property (nullable, nonatomic, copy) void (^touchesCancelled)(void);
    @property (nullable, nonatomic, copy) void (^touchesEnded)(void);
    
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWImageCropToolbar : UIView
    
    /* In horizontal mode, offsets all of the buttons vertically by height of status bar. */
    @property (nonatomic, assign) CGFloat statusBarHeightInset;
    /// 按钮内边距,默认16
    @property (nonatomic, assign) CGFloat buttonInsetPadding;
    
    /* Set an inset that will expand the background view beyond the bounds. */
    @property (nonatomic, strong, readonly) UIView *backgroundView;
    @property (nonatomic, assign) UIEdgeInsets backgroundViewOutsets;
    
    /* The 'Done' buttons to commit the crop. The text button is displayed
     in portrait mode and the icon one, in landscape. */
    @property (nonatomic, strong, readonly) UIButton *doneTextButton;
    @property (nonatomic, strong, readonly) UIButton *doneIconButton;
    @property (nonatomic, copy) NSString *doneTextButtonTitle;
    
    
    /* The 'Cancel' buttons to cancel the crop. The text button is displayed
     in portrait mode and the icon one, in landscape. */
    @property (nonatomic, strong, readonly) UIButton *cancelTextButton;
    @property (nonatomic, strong, readonly) UIButton *cancelIconButton;
    @property (nonatomic, readonly) UIView *visibleCancelButton;
    @property (nonatomic, copy) NSString *cancelTextButtonTitle;
    
    /* The cropper control buttons */
    @property (nonatomic, strong, readonly)  UIButton *rotateCounterclockwiseButton;
    @property (nonatomic, strong, readonly)  UIButton *resetButton;
    @property (nonatomic, strong, readonly)  UIButton *clampButton;
    @property (nullable, nonatomic, strong, readonly) UIButton *rotateClockwiseButton;
    
    @property (nonatomic, readonly) UIButton *rotateButton; // Points to `rotateCounterClockwiseButton`
    
    /* Button feedback handler blocks */
    @property (nullable, nonatomic, copy) void (^cancelButtonTapped)(void);
    @property (nullable, nonatomic, copy) void (^doneButtonTapped)(void);
    @property (nullable, nonatomic, copy) void (^rotateCounterclockwiseButtonTapped)(void);
    @property (nullable, nonatomic, copy) void (^rotateClockwiseButtonTapped)(void);
    @property (nullable, nonatomic, copy) void (^clampButtonTapped)(void);
    @property (nullable, nonatomic, copy) void (^resetButtonTapped)(void);
    
    /* State management for the 'clamp' button */
    @property (nonatomic, assign) BOOL clampButtonGlowing;
    @property (nonatomic, readonly) CGRect clampButtonFrame;
    
    /* Aspect ratio button visibility settings */
    @property (nonatomic, assign) BOOL clampButtonHidden;
    @property (nonatomic, assign) BOOL rotateCounterclockwiseButtonHidden;
    @property (nonatomic, assign) BOOL rotateClockwiseButtonHidden;
    @property (nonatomic, assign) BOOL resetButtonHidden;
    @property (nonatomic, assign) BOOL doneButtonHidden;
    @property (nonatomic, assign) BOOL cancelButtonHidden;
    
    /* Enable the reset button */
    @property (nonatomic, assign) BOOL resetButtonEnabled;
    
    /* Done button frame for popover controllers */
    @property (nonatomic, readonly) CGRect doneButtonFrame;
    
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWImageCropView : UIView
    
    /**
     The image that the crop view is displaying. This cannot be changed once the crop view is instantiated.
     */
    @property (nonnull, nonatomic, strong, readonly) UIImage *image;
    
    /**
     The cropping style of the crop view (eg, rectangular or circular)
     */
    @property (nonatomic, assign, readonly) FWImageCropCroppingStyle croppingStyle;
    
    /**
     A grid view overlaid on top of the foreground image view's container.
     */
    @property (nonnull, nonatomic, strong, readonly) FWImageCropOverlayView *gridOverlayView;
    
    /**
     A container view that clips the a copy of the image so it appears over the dimming view
     */
    @property (nonnull, nonatomic, readonly) UIView *foregroundContainerView;
    
    /**
     A delegate object that receives notifications from the crop view
     */
    @property (nullable, nonatomic, weak) id<FWImageCropViewDelegate> delegate;
    
    /**
     If false, the user cannot resize the crop box frame using a pan gesture from a corner.
     Default vaue is YES.
     */
    @property (nonatomic, assign) BOOL cropBoxResizeEnabled;
    
    /**
     Whether the user has manipulated the crop view to the point where it can be reset
     */
    @property (nonatomic, readonly) BOOL canBeReset;
    
    /**
     The frame of the cropping box in the coordinate space of the crop view
     */
    @property (nonatomic, readonly) CGRect cropBoxFrame;
    
    /**
     The frame of the entire image in the backing scroll view
     */
    @property (nonatomic, readonly) CGRect imageViewFrame;
    
    /**
     Inset the workable region of the crop view in case in order to make space for accessory views
     */
    @property (nonatomic, assign) UIEdgeInsets cropRegionInsets;
    
    /**
     Disable the dynamic translucency in order to smoothly relayout the view
     */
    @property (nonatomic, assign) BOOL simpleRenderMode;
    
    /**
     When performing manual content layout (such as during screen rotation), disable any internal layout
     */
    @property (nonatomic, assign) BOOL internalLayoutDisabled;
    
    /**
     A width x height ratio that the crop box will be rescaled to (eg 4:3 is {4.0f, 3.0f})
     Setting it to CGSizeZero will reset the aspect ratio to the image's own ratio.
     */
    @property (nonatomic, assign) CGSize aspectRatio;
    
    /**
     When the cropping box is locked to its current aspect ratio (But can still be resized)
     */
    @property (nonatomic, assign) BOOL aspectRatioLockEnabled;
    
    /**
     If true, a custom aspect ratio is set, and the aspectRatioLockEnabled is set to YES,
     the crop box will swap it's dimensions depending on portrait or landscape sized images.
     This value also controls whether the dimensions can swap when the image is rotated.
     
     Default is NO.
     */
    @property (nonatomic, assign) BOOL aspectRatioLockDimensionSwapEnabled;
    
    /**
     When the user taps 'reset', whether the aspect ratio will also be reset as well
     Default is YES
     */
    @property (nonatomic, assign) BOOL resetAspectRatioEnabled;
    
    /**
     True when the height of the crop box is bigger than the width
     */
    @property (nonatomic, readonly) BOOL cropBoxAspectRatioIsPortrait;
    
    /**
     The rotation angle of the crop view (Will always be negative as it rotates in a counter-clockwise direction)
     */
    @property (nonatomic, assign) NSInteger angle;
    
    /**
     Hide all of the crop elements for transition animations
     */
    @property (nonatomic, assign) BOOL croppingViewsHidden;
    
    /**
     In relation to the coordinate space of the image, the frame that the crop view is focusing on
     */
    @property (nonatomic, assign) CGRect imageCropFrame;
    
    /**
     Set the grid overlay graphic to be hidden
     */
    @property (nonatomic, assign) BOOL gridOverlayHidden;
    
    ///**
    // Paddings of the crop rectangle. Default to 14.0
    // */
    @property (nonatomic) CGFloat cropViewPadding;
    
    /**
     Delay before crop frame is adjusted according new crop area. Default to 0.8
     */
    @property (nonatomic) NSTimeInterval cropAdjustingDelay;
    
    /**
    The minimum croping aspect ratio. If set, user is prevented from setting cropping
     rectangle to lower aspect ratio than defined by the parameter.
    */
    @property (nonatomic, assign) CGFloat minimumAspectRatio;
    
    /**
     The maximum scale that user can apply to image by pinching to zoom. Small values
     are only recomended with aspectRatioLockEnabled set to true. Default to 15.0
     */
    @property (nonatomic, assign) CGFloat maximumZoomScale;
    
    /**
     Always show the cropping grid lines, even when the user isn't interacting.
     This also disables the fading animation.
     (Default is NO)
     */
    @property (nonatomic, assign) BOOL alwaysShowCroppingGrid;
    
    /**
     Permanently hides the translucency effect covering the outside bounds of the
     crop box. (Default is NO)
     */
    @property (nonatomic, assign) BOOL translucencyAlwaysHidden;
    
    /**
     Create a default instance of the crop view with the supplied image
     */
    - (nonnull instancetype)initWithImage:(nonnull UIImage *)image;
    
    /**
     Create a new instance of the crop view with the specified image and cropping
     */
    - (nonnull instancetype)initWithCroppingStyle:(FWImageCropCroppingStyle)style image:(nonnull UIImage *)image;
    
    /**
     Performs the initial set up, including laying out the image and applying any restore properties.
     This should be called once the crop view has been added to a parent that is in its final layout frame.
     */
    - (void)performInitialSetup;
    
    /**
     When performing large size transitions (eg, orientation rotation),
     set simple mode to YES to temporarily graphically heavy effects like translucency.
     
     @param simpleMode Whether simple mode is enabled or not
     
     */
    - (void)setSimpleRenderMode:(BOOL)simpleMode animated:(BOOL)animated;
    
    /**
     When performing a screen rotation that will change the size of the scroll view, this takes
     a snapshot of all of the scroll view data before it gets manipulated by iOS.
     Please call this in your view controller, before the rotation animation block is committed.
     */
    - (void)prepareforRotation;
    
    /**
     Performs the realignment of the crop view while the screen is rotating.
     Please call this inside your view controller's screen rotation animation block.
     */
    - (void)performRelayoutForRotation;
    
    /**
     Reset the crop box and zoom scale back to the initial layout
     
     @param animated The reset is animated
     */
    - (void)resetLayoutToDefaultAnimated:(BOOL)animated;
    
    /**
     Changes the aspect ratio of the crop box to match the one specified
     
     @param aspectRatio The aspect ratio (For example 16:9 is 16.0f/9.0f). 'CGSizeZero' will reset it to the image's own ratio
     @param animated Whether the locking effect is animated
     */
    - (void)setAspectRatio:(CGSize)aspectRatio animated:(BOOL)animated;
    
    /**
     Rotates the entire canvas to a 90-degree angle. The default rotation is counterclockwise.
     
     @param animated Whether the transition is animated
     */
    - (void)rotateImageNinetyDegreesAnimated:(BOOL)animated;
    
    /**
     Rotates the entire canvas to a 90-degree angle
     
     @param animated Whether the transition is animated
     @param clockwise Whether the rotation is clockwise. Passing 'NO' means counterclockwise
     */
    - (void)rotateImageNinetyDegreesAnimated:(BOOL)animated clockwise:(BOOL)clockwise;
    
    /**
     Animate the grid overlay graphic to be visible
     */
    - (void)setGridOverlayHidden:(BOOL)gridOverlayHidden animated:(BOOL)animated;
    
    /**
     Animate the cropping component views to become visible
     */
    - (void)setCroppingViewsHidden:(BOOL)hidden animated:(BOOL)animated;
    
    /**
     Animate the background image view to become visible
     */
    - (void)setBackgroundImageViewHidden:(BOOL)hidden animated:(BOOL)animated;
    
    /**
     When triggered, the crop view will perform a relayout to ensure the crop box
     fills the entire crop view region
     */
    - (void)moveCroppedContentToCenterAnimated:(BOOL)animated;
    
    @end

FWImageAlbumController

  • 相册列表默认Cell

    See more

    Declaration

    Objective-C

    
    @interface FWImageAlbumTableCell : UITableViewCell
  • 当前设备照片里的相簿列表,使用方式:

    1. 使用 init 初始化。
    2. 指定一个 albumControllerDelegate,并实现 @required 方法。

    注意,iOS 访问相册需要得到授权,建议先询问用户授权([FWAssetsManager requestAuthorization:]),通过了再进行 FWImageAlbumController 的初始化工作。

    See more

    Declaration

    Objective-C

    
    @interface FWImageAlbumController
        : UIViewController <UITableViewDataSource, UITableViewDelegate>

FWImagePickerPreviewController

  • Undocumented

    See more

    Declaration

    Objective-C

    
    @interface FWImagePickerPreviewController
        : FWImagePreviewController <UICollectionViewDataSource,
                                    UICollectionViewDelegate,
                                    FWImagePreviewViewDelegate>
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWImagePickerPreviewCollectionCell : UICollectionViewCell
    
    /// 缩略图视图
    @property(nonatomic, strong, readonly) UIImageView *imageView;
    /// imageView内边距,默认zero占满
    @property(nonatomic, assign) UIEdgeInsets imageViewInsets UI_APPEARANCE_SELECTOR;
    /// 选中边框颜色,默认白色
    @property(nullable, nonatomic, strong) UIColor *checkedBorderColor UI_APPEARANCE_SELECTOR;
    /// 选中边框宽度,默认3
    @property(nonatomic, assign) CGFloat checkedBorderWidth UI_APPEARANCE_SELECTOR;
    /// 禁用时蒙层颜色
    @property(nonatomic, strong, nullable) UIColor *disabledMaskColor UI_APPEARANCE_SELECTOR;
    /// 蒙层视图
    @property(nonatomic, strong, readonly) UIView *maskView;
    /// 当前是否选中
    @property(nonatomic, assign) BOOL checked;
    /// 当前是否禁用,默认NO
    @property(nonatomic, assign) BOOL disabled;
    
    @property(nonatomic, strong, readonly) UILabel *videoDurationLabel;
    /// 是否显示videoDurationLabel,默认YES
    @property(nonatomic, assign) BOOL showsVideoDurationLabel UI_APPEARANCE_SELECTOR;
    /// videoDurationLabel 的字号
    @property(nonatomic, strong) UIFont *videoDurationLabelFont UI_APPEARANCE_SELECTOR;
    /// videoDurationLabel 的字体颜色
    @property(nonatomic, strong) UIColor *videoDurationLabelTextColor UI_APPEARANCE_SELECTOR;
    /// 视频时长文字的间距,相对于 cell 右下角而言,也即如果 right 越大则越往左,bottom 越大则越往上,另外 top 会影响底部遮罩的高度
    @property(nonatomic, assign) UIEdgeInsets videoDurationLabelMargins UI_APPEARANCE_SELECTOR;
    
    /// 左下角图标视图,默认判断显示editedIconImage和videoIconImage
    @property(nonatomic, strong, readonly) UIImageView *iconImageView;
    @property(nullable, nonatomic, strong) UIImage *editedIconImage UI_APPEARANCE_SELECTOR;
    @property(nullable, nonatomic, strong) UIImage *videoIconImage UI_APPEARANCE_SELECTOR;
    @property(nonatomic, assign) UIEdgeInsets iconImageViewMargins UI_APPEARANCE_SELECTOR;
    
    /// 当前这个 cell 正在展示的 FWAsset 的 identifier
    @property(nonatomic, copy, nullable) NSString *assetIdentifier;
    - (void)renderWithAsset:(FWAsset *)asset referenceSize:(CGSize)referenceSize;
    
    @end

FWImagePickerController

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWImagePickerController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegate, FWImagePickerPreviewControllerDelegate>
    
    @property(nullable, nonatomic, weak) id<FWImagePickerControllerDelegate> imagePickerControllerDelegate;
    /// 自定义预览控制器句柄,优先级低于delegate
    @property(nullable, nonatomic, copy) FWImagePickerPreviewController * (^previewControllerBlock)(void);
    /// 自定义相册控制器句柄,优先级低于delegate
    @property(nullable, nonatomic, copy) FWImageAlbumController * (^albumControllerBlock)(void);
    /// 自定义cell展示句柄,cellForItem自动调用,优先级低于delegate
    @property(nullable, nonatomic, copy) void (^customCellBlock)(FWImagePickerCollectionCell *cell, NSIndexPath *indexPath);
    
    /// 图片选取完成回调句柄,优先级低于delegate
    @property(nullable, nonatomic, copy) void (^didFinishPicking)(NSArray<FWAsset *> *imagesAssetArray);
    /// 图片选取取消回调句柄,优先级低于delegate
    @property(nullable, nonatomic, copy) void (^didCancelPicking)(void);
    
    @property(nullable, nonatomic, strong) UIColor *toolBarBackgroundColor;
    @property(nullable, nonatomic, strong) UIColor *toolBarTintColor;
    
    /// 当前titleView,默认不可点击,contentType方式会自动切换点击状态
    @property(nonatomic, strong, readonly) FWToolbarTitleView *titleView;
    /// 标题视图accessoryImage,默认nil,contentType方式会自动设置
    @property(nullable, nonatomic, strong) UIImage *titleAccessoryImage;
    
    /*
     * 图片的最小尺寸,布局时如果有剩余空间,会将空间分配给图片大小,所以最终显示出来的大小不一定等于minimumImageWidth。默认是75。
     * @warning collectionViewLayout 和 collectionView 可能有设置 sectionInsets 和 contentInsets,所以设置几行不可以简单的通过 screenWdith / columnCount 来获得
     */
    @property(nonatomic, assign) CGFloat minimumImageWidth;
    /// 图片显示列数,默认0使用minimumImageWidth自动计算,指定后固定列数
    @property(nonatomic, assign) NSInteger imageColumnCount;
    
    @property(nonatomic, strong, readonly) UICollectionViewFlowLayout *collectionViewLayout;
    @property(nonatomic, strong, readonly) UICollectionView *collectionView;
    
    @property(nonatomic, strong, readonly) UIView *operationToolBarView;
    /// 自定义工具栏高度,默认同系统
    @property(nonatomic, assign) CGFloat operationToolBarHeight;
    @property(nonatomic, assign) CGFloat toolBarPaddingHorizontal;
    @property(nonatomic, strong, readonly) UIButton *previewButton;
    @property(nonatomic, strong, readonly) UIButton *sendButton;
    
    /// 也可以直接传入 FWAssetGroup,然后读取其中的 FWAsset 并储存到 imagesAssetArray 中,传入后会赋值到 FWAssetGroup,并自动刷新 UI 展示
    - (void)refreshWithAssetsGroup:(FWAssetGroup * _Nullable)assetsGroup;
    
    /// 根据filterType刷新,自动选取第一个符合条件的相册,自动初始化并使用albumController
    - (void)refreshWithFilterType:(FWImagePickerFilterType)filterType;
    
    @property(nullable, nonatomic, strong, readonly) NSMutableArray<FWAsset *> *imagesAssetArray;
    @property(nullable, nonatomic, strong, readonly) FWAssetGroup *assetsGroup;
    /// 图片过滤类型,默认0不过滤,影响requestImage结果和previewController预览效果
    @property(nonatomic, assign) FWImagePickerFilterType filterType;
    
    /// 当前被选择的图片对应的 FWAsset 对象数组
    @property(nullable, nonatomic, strong, readonly) NSMutableArray<FWAsset *> *selectedImageAssetArray;
    
    /// 是否允许图片多选,默认为 YES。如果为 NO,则不显示 checkbox 和底部工具栏
    @property(nonatomic, assign) BOOL allowsMultipleSelection;
    
    /// 是否禁用预览时左右滚动,默认NO。如果为YES,单选时不能左右滚动切换图片
    @property(nonatomic, assign) BOOL previewScrollDisabled;
    
    /// 最多可以选择的图片数,默认为9
    @property(nonatomic, assign) NSUInteger maximumSelectImageCount;
    
    /// 最少需要选择的图片数,默认为 0
    @property(nonatomic, assign) NSUInteger minimumSelectImageCount;
    
    /// 是否显示默认loading,优先级低于delegate,默认YES
    @property(nonatomic, assign) BOOL showsDefaultLoading;
    
    /// 是否需要请求图片资源,默认NO,开启后会先requestImagesAssetArray再回调didFinishPicking
    @property(nonatomic, assign) BOOL shouldRequestImage;
    
    /// 图片过滤类型转换为相册内容类型
    + (FWAlbumContentType)albumContentTypeWithFilterType:(FWImagePickerFilterType)filterType;
    
    /**
     * 检查并下载一组资源,如果资源仍未从 iCloud 中成功下载,则会发出请求从 iCloud 加载资源,下载完成后,主线程回调。
     * 图片资源对象和结果信息保存在FWAsset.requestObject,自动根据过滤类型返回UIImage|PHLivePhoto|NSURL
     */
    + (void)requestImagesAssetArray:(NSArray<FWAsset *> *)imagesAssetArray
                         filterType:(FWImagePickerFilterType)filterType
                          useOrigin:(BOOL)useOrigin
                         completion:(nullable void (^)(void))completion;
    
    @end

FWImagePickerCollectionCell

  • 图片选择空间里的九宫格 cell,支持显示 checkbox、饼状进度条及重试按钮(iCloud 图片需要)

    See more

    Declaration

    Objective-C

    
    @interface FWImagePickerCollectionCell : UICollectionViewCell

FWImagePickerControllerImpl

FWImagePickerPluginImpl

FWImagePreviewView

  • 查看图片的控件,支持横向滚动、放大缩小、loading 及错误语展示,内部使用 UICollectionView 实现横向滚动及 cell 复用,因此与其他普通的 UICollectionView 一样,也可使用 reloadData、collectionViewLayout 等常用方法。

    使用方式:

    1. 使用 initWithFrame: 或 init 方法初始化。
    2. 设置 delegate。
    3. 在 delegate 的 numberOfImagesInImagePreviewView: 方法里返回图片总数。
    4. 在 delegate 的 imagePreviewView:renderZoomImageView:atIndex: 方法里为 zoomImageView.image 设置图片,如果需要,也可调用 [zoomImageView showLoading] 等方法来显示 loading。
    5. 由于 FWImagePreviewViewDelegate 继承自 FWZoomImageViewDelegate,所以若需要响应单击、双击、长按事件,请实现 FWZoomImageViewDelegate 里的对应方法。
    6. 若需要从指定的某一张图片开始查看,可使用 currentImageIndex 属性。
    See more

    Declaration

    Objective-C

    
    @interface FWImagePreviewView
        : UIView <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout,
                  FWZoomImageViewDelegate>

FWImagePreviewController

  • 图片预览控件,主要功能由内部自带的 FWImagePreviewView 提供,由于以 viewController 的形式存在,所以适用于那种在单独界面里展示图片,或者需要从某张目标图片的位置以动画的形式放大进入预览界面的场景。

    使用方式:

    1. 使用 init 方法初始化
    2. 添加 self.imagePreviewView 的 delegate
    3. 以 push 或 present 的方式打开界面。如果是 present,则支持 FWImagePreviewTransitioningStyle 里定义的动画。特别地,如果使用 zoom 方式,则需要通过 sourceImageView() 返回一个原界面上的 view 以作为 present 动画的起点和 dismiss 动画的终点。
    See more

    Declaration

    Objective-C

    
    @interface FWImagePreviewController
        : UIViewController <UIViewControllerTransitioningDelegate>

FWImagePreviewTransitionAnimator

  • 负责处理 FWImagePreviewController 被 present/dismiss 时的动画,如果需要自定义动画效果,可按需修改 animationEnteringBlock、animationBlock、animationCompletionBlock。

    See more

    Declaration

    Objective-C

    
    @interface FWImagePreviewTransitionAnimator
        : NSObject <UIViewControllerAnimatedTransitioning>

FWCollectionViewPagingLayout

  • 支持按页横向滚动的 UICollectionViewLayout,可切换不同类型的滚动动画。

    Warning

    item 的大小和布局仅支持通过 UICollectionViewFlowLayout 的 property 系列属性修改,也即每个 item 都应相等。对于通过 delegate 方式返回各不相同的 itemSize、sectionInset 的场景是不支持的。
    See more

    Declaration

    Objective-C

    
    @interface FWCollectionViewPagingLayout : UICollectionViewFlowLayout

FWImagePreviewPluginImpl

FWIndicatorView

FWNavigationBarAppearance

  • 导航栏样式配置

    See more

    Declaration

    Objective-C

    
    @interface FWNavigationBarAppearance : NSObject
  • FWNetworkAgent is the underlying class that handles actual request generation, serialization and response handling.

    See more

    Declaration

    Objective-C

    
    @interface FWNetworkAgent : NSObject
  • FWNetworkConfig stored global network-related configurations, which will be used in FWNetworkAgent to form and filter requests, as well as caching response.

    See more

    Declaration

    Objective-C

    
    @interface FWNetworkConfig : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWNetworkUtils : NSObject
    
    + (BOOL)validateJSON:(id)json withValidator:(id)jsonValidator;
    
    + (void)addDoNotBackupAttribute:(NSString *)path;
    
    + (NSString *)md5StringFromString:(NSString *)string;
    
    + (NSString *)appVersionString;
    
    + (NSStringEncoding)stringEncodingWithRequest:(FWBaseRequest *)request;
    
    + (BOOL)validateResumeData:(NSData *)data;
    
    + (BOOL)isRequestError:(nullable NSError *)error;
    
    @end
  • FWRequest is the base class you should inherit to create your own request class. Based on FWBaseRequest, FWRequest adds local caching feature. Note download request will not be cached whatsoever, because download request may involve complicated cache control policy controlled by Cache-Control, Last-Modified, etc. https://github.com/yuantiku/YTKNetwork

    See more

    Declaration

    Objective-C

    
    @interface FWRequest : FWBaseRequest
  • FWNetworkReachabilityManager monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.

    Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it’s possible that an initial request may be required to establish reachability.

    See Apple’s Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )

    Warning

    Instances of FWNetworkReachabilityManager must be started with -startMonitoring before reachability status can be determined.
    See more

    Declaration

    Objective-C

    
    @interface FWNetworkReachabilityManager : NSObject

FWOAuth2Manager

FWOAuthCredential

  • FWOAuthCredential models the credentials returned from an OAuth server, storing the token type, access & refresh tokens, and whether the token is expired.

    OAuth credentials can be stored in the user’s keychain, and retrieved on subsequent launches.

    See more

    Declaration

    Objective-C

    
    @interface FWOAuthCredential : NSObject <NSCoding>
  • FWHTTPRequestSerializer conforms to the FWURLRequestSerialization & FWURLResponseSerialization protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.

    Any request or response serializer dealing with HTTP is encouraged to subclass FWHTTPRequestSerializer in order to ensure consistent default behavior.

    See more

    Declaration

    Objective-C

    
    @interface FWHTTPRequestSerializer : NSObject <FWURLRequestSerialization>

FWPageControl

FWDotView

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWDotView : UIView <FWDotViewProtocol>
    
    @property (nonatomic, strong) UIColor *dotColor;
    
    @property (nonatomic, strong) UIColor *currentDotColor;
    
    @property (nonatomic, assign) BOOL isAnimated;
    
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FWBorderDotView : FWDotView
    
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPasscodeFlowLayout : UICollectionViewFlowLayout
    
    @property (assign, nonatomic) BOOL equalGap;
    
    @property (assign, nonatomic) NSInteger itemNum;
    
    @property (assign, nonatomic) NSInteger minLineSpacing;
    
    - (void)updateLineSpacing;
    
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPasscodeLineView : UIView
    
    @property (strong, nonatomic) UIView    *lineView;
    @property (assign, nonatomic) BOOL      selected;
    
    /**
     下划线颜色,未选中状态,且没有填充文字时。默认:[UIColor colorWithRed:49/255.0 green:51/255.0 blue:64/255.0 alpha:1]
     */
    @property (copy, nonatomic) UIColor *underlineColorNormal;
    
    /**
     下划线颜色,选中状态时。默认:[UIColor colorWithRed:49/255.0 green:51/255.0 blue:64/255.0 alpha:1]
     */
    @property (copy, nonatomic) UIColor *underlineColorSelected;
    
    /**
     下划线颜色,未选中状态,且有填充文字时。默认:[UIColor colorWithRed:49/255.0 green:51/255.0 blue:64/255.0 alpha:1]
     */
    @property (copy, nonatomic) UIColor *underlineColorFilled;
    
    /**
     选择状态改变时回调
     */
    @property (nullable, copy, nonatomic) void(^selectChangeBlock)(FWPasscodeLineView *lineView, BOOL selected);
    
    - (instancetype)initWithFrame:(CGRect)frame UNAVAILABLE_ATTRIBUTE;
    
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPasscodeSecrectImageView : UIView
    
    @property (strong, nonatomic) UIImage   *image;
    @property (assign, nonatomic) CGFloat   imageWidth;
    @property (assign, nonatomic) CGFloat   imageHeight;
    
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPasscodeCellProperty : NSObject <NSCopying>
    
    #pragma mark - UI
    /**
     cell边框宽度,默认:0.5
     */
    @property (assign, nonatomic) CGFloat borderWidth;
    
    /**
     cell边框颜色,未选中状态时。默认:[UIColor colorWithRed:228/255.0 green:228/255.0 blue:228/255.0 alpha:1]
     */
    @property (copy, nonatomic) UIColor *cellBorderColorNormal;
    
    /**
     cell边框颜色,选中状态时。默认:[UIColor colorWithRed:255/255.0 green:70/255.0 blue:62/255.0 alpha:1]
     */
    @property (copy, nonatomic) UIColor *cellBorderColorSelected;
    
    /**
     cell边框颜色,无填充文字,未选中状态时。默认:与cellBorderColorFilled相同
     */
    @property (copy, nonatomic) UIColor *__nullable cellBorderColorFilled;
    
    /**
     cell背景颜色,无填充文字,未选中状态时。默认:[UIColor whiteColor]
     */
    @property (copy, nonatomic) UIColor *cellBgColorNormal;
    
    /**
     cell背景颜色,选中状态时。默认:[UIColor whiteColor]
     */
    @property (copy, nonatomic) UIColor *cellBgColorSelected;
    
    /**
     cell背景颜色,填充文字后,未选中状态时。默认:与cellBgColorFilled相同
     */
    @property (copy, nonatomic) UIColor *__nullable cellBgColorFilled;
    
    /**
     光标颜色。默认: [UIColor colorWithRed:255/255.0 green:70/255.0 blue:62/255.0 alpha:1]
     */
    @property (copy, nonatomic) UIColor *cellCursorColor;
    
    /**
     光标宽度。默认: 2
     */
    @property (assign, nonatomic) CGFloat cellCursorWidth;
    
    /**
     光标高度。默认: 32
     */
    @property (assign, nonatomic) CGFloat cellCursorHeight;
    
    /**
     圆角。默认: 4
     */
    @property (assign, nonatomic) CGFloat cornerRadius;
    
    
    
    #pragma mark - line
    /**
     显示下划线。默认: NO
     */
    @property (assign, nonatomic) BOOL showLine;
    
    
    
    #pragma mark - label
    /**
     字体/字号。默认:[UIFont systemFontOfSize:20];
     */
    @property (copy, nonatomic) UIFont *cellFont;
    
    /**
     字体颜色。默认:[UIColor blackColor];
     */
    @property (copy, nonatomic) UIColor *cellTextColor;
    
    
    
    #pragma mark - Security
    /**
     是否密文显示。默认:NO
     */
    @property (assign, nonatomic) BOOL showSecurity;
    
    /**
     密文符号。默认:✱
     说明:只有showSecurity=YES时,有效
     */
    @property (copy, nonatomic) NSString *securitySymbol;
    
    /**
     保存当前显示的字符,若想一次性修改所有输入值,请使用reloadInputString方法
     禁止修改该值!!!(除非你知道该怎么使用它。)
     */
    @property (copy, nonatomic, readonly) NSString *originValue;
    - (void)customOriginValue:(NSString *)originValue;
    
    /**
     密文类型,默认:FWPasscodeSecurityTypeSymbol
     类型说明:
     FWPasscodeSecurityTypeSymbol 符号类型,根据securitySymbol,originValue的内容来显示
     FWPasscodeSecurityTypeView 自定义View类型,可以自定义密文状态下的图片,View
     */
    @property (assign, nonatomic) FWPasscodeSecurityType securityType;
    
    
    
    #pragma mark - Placeholder
    /**
     占位符默认填充值
     禁止修改该值!!!(除非你知道该怎么使用它。)
     */
    @property (strong, nonatomic) NSString  *__nullable cellPlaceholderText;
    
    /**
     占位符字体颜色,默认:[UIColor colorWithRed:114/255.0 green:126/255.0 blue:124/255.0 alpha:0.3];
     */
    @property (copy, nonatomic) UIColor *cellPlaceholderTextColor;
    
    /**
     占位符字体/字号,默认:[UIFont systemFontOfSize:20];
     */
    @property (copy, nonatomic) UIFont *cellPlaceholderFont;
    
    
    
    #pragma mark - Block
    /**
     自定义密文View回调
     */
    @property (copy, nonatomic) UIView *_Nonnull(^customSecurityViewBlock)(void);
    /**
     自定义下划线回调
     */
    @property (copy, nonatomic) FWPasscodeLineView *_Nonnull(^customLineViewBlock)(void);
    /**
     自定义阴影回调
     */
    @property (copy, nonatomic, nullable) void(^configCellShadowBlock)(CALayer *layer);
    
    @property (assign, nonatomic) NSInteger index;
    
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPasscodeCell : UICollectionViewCell
    
    /**
     cursor, You should not use these properties, unless you know what you are doing.
     */
    @property (strong, nonatomic) UIView *cursorView;
    @property (assign, nonatomic) BOOL showCursor;
    
    /**
     cellProperty, You should not use these properties, unless you know what you are doing.
     */
    @property (strong, nonatomic) FWPasscodeCellProperty *cellProperty;
    
    @end
  • Declaration

    Objective-C

    
    @interface FWPasscodeView : UIView

FWPlayerCacheLoaderManager

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPlayerCacheLoaderManager : NSObject <AVAssetResourceLoaderDelegate>
    
    @property (nonatomic, weak, nullable) id<FWPlayerCacheLoaderManagerDelegate> delegate;
    
    /**
     Normally you no need to call this method to clean cache. Cache cleaned after AVPlayer delloc.
     If you have a singleton AVPlayer then you need call this method to clean cache at suitable time.
     */
    - (void)cleanCache;
    
    /**
     Cancel all downloading loaders.
     */
    - (void)cancelLoaders;
    
    + (NSURL *)assetURLWithURL:(NSURL *)url;
    
    - (AVURLAsset *)URLAssetWithURL:(NSURL *)url;
    - (AVPlayerItem *)playerItemWithURL:(NSURL *)url;
    
    @end

FWPlayerCacheLoader

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPlayerCacheLoader : NSObject
    
    @property (nonatomic, strong, readonly) NSURL *url;
    @property (nonatomic, weak) id<FWPlayerCacheLoaderDelegate> delegate;
    
    - (instancetype)initWithURL:(NSURL *)url;
    
    - (void)addRequest:(AVAssetResourceLoadingRequest *)request;
    - (void)removeRequest:(AVAssetResourceLoadingRequest *)request;
    
    - (void)cancel;
    
    @end

FWPlayerCacheDownloader

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPlayerCacheDownloaderStatus : NSObject
    
    + (instancetype)shared;
    
    - (void)addURL:(NSURL *)url;
    - (void)removeURL:(NSURL *)url;
    
    /**
     return YES if downloading the url source
     */
    - (BOOL)containsURL:(NSURL *)url;
    - (NSSet *)urls;
    
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPlayerCacheDownloader : NSObject
    
    - (instancetype)initWithURL:(NSURL *)url cacheWorker:(FWPlayerCacheWorker *)cacheWorker;
    @property (nonatomic, strong, readonly) NSURL *url;
    @property (nonatomic, weak) id<FWPlayerCacheDownloaderDelegate> delegate;
    @property (nonatomic, strong) FWPlayerCacheContentInfo *info;
    @property (nonatomic, assign) BOOL saveToCache;
    
    - (void)downloadTaskFromOffset:(unsigned long long)fromOffset
                            length:(NSUInteger)length
                             toEnd:(BOOL)toEnd;
    - (void)downloadFromStartToEnd;
    
    - (void)cancel;
    
    @end

FWPlayerCacheRequestWorker

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPlayerCacheRequestWorker : NSObject
    
    - (instancetype)initWithMediaDownloader:(FWPlayerCacheDownloader *)mediaDownloader resourceLoadingRequest:(AVAssetResourceLoadingRequest *)request;
    
    @property (nonatomic, weak) id<FWPlayerCacheRequestWorkerDelegate> delegate;
    
    @property (nonatomic, strong, readonly) AVAssetResourceLoadingRequest *request;
    
    - (void)startWork;
    - (void)cancel;
    - (void)finish;
    
    @end

FWPlayerCacheContentInfo

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPlayerCacheContentInfo : NSObject <NSCoding>
    
    @property (nonatomic, copy) NSString *contentType;
    @property (nonatomic, assign) BOOL byteRangeAccessSupported;
    @property (nonatomic, assign) unsigned long long contentLength;
    @property (nonatomic) unsigned long long downloadedContentLength;
    
    @end

FWPlayerCacheAction

FWPlayerCacheConfiguration

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPlayerCacheConfiguration : NSObject <NSCopying>
    
    + (NSString *)configurationFilePathForFilePath:(NSString *)filePath;
    
    + (instancetype)configurationWithFilePath:(NSString *)filePath;
    
    @property (nonatomic, copy, readonly) NSString *filePath;
    @property (nonatomic, strong) FWPlayerCacheContentInfo *contentInfo;
    @property (nonatomic, strong) NSURL *url;
    
    - (NSArray<NSValue *> *)cacheFragments;
    
    /**
     *  cached progress
     */
    @property (nonatomic, readonly) float progress;
    @property (nonatomic, readonly) long long downloadedBytes;
    @property (nonatomic, readonly) float downloadSpeed; // kb/s
    
    #pragma mark - update API
    
    - (void)save;
    - (void)addCacheFragment:(NSRange)fragment;
    
    /**
     *  Record the download speed
     */
    - (void)addDownloadedBytes:(long long)bytes spent:(NSTimeInterval)time;
    
    + (BOOL)createAndSaveDownloadedConfigurationForURL:(NSURL *)url error:(NSError **)error;
    
    @end

FWPlayerCacheManager

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPlayerCacheManager : NSObject
    
    + (void)setCacheDirectory:(NSString *)cacheDirectory;
    + (NSString *)cacheDirectory;
    
    
    /**
     How often trigger `FWPlayerCacheManagerDidUpdateCacheNotification` notification
    
     @param interval Minimum interval
     */
    + (void)setCacheUpdateNotifyInterval:(NSTimeInterval)interval;
    + (NSTimeInterval)cacheUpdateNotifyInterval;
    
    + (NSString *)cachedFilePathForURL:(NSURL *)url;
    + (FWPlayerCacheConfiguration *)cacheConfigurationForURL:(NSURL *)url;
    
    + (void)setFileNameRules:(NSString *(^)(NSURL *url))rules;
    
    
    /**
     Calculate cached files size
    
     @param error If error not empty, calculate failed
     @return files size, respresent by `byte`, if error occurs, return -1
     */
    + (unsigned long long)calculateCachedSizeWithError:(NSError **)error;
    + (void)cleanAllCacheWithError:(NSError **)error;
    + (void)cleanCacheForURL:(NSURL *)url error:(NSError **)error;
    
    
    /**
     Useful when you upload a local file to the server
    
     @param filePath local file path
     @param url remote resource url
     @param error On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information.
     */
    + (BOOL)addCacheFile:(NSString *)filePath forURL:(NSURL *)url error:(NSError **)error;
    
    @end

FWPlayerCacheSessionManager

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPlayerCacheSessionManager : NSObject
    
    @property (nonatomic, strong, readonly) NSOperationQueue *downloadQueue;
    
    + (instancetype)shared;
    
    @end

FWPlayerCacheWorker

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPlayerCacheWorker : NSObject
    
    - (instancetype)initWithURL:(NSURL *)url;
    
    @property (nonatomic, strong, readonly) FWPlayerCacheConfiguration *cacheConfiguration;
    @property (nonatomic, strong, readonly) NSError *setupError; // Create fileHandler error, can't save/use cache
    
    - (void)cacheData:(NSData *)data forRange:(NSRange)range error:(NSError **)error;
    - (NSArray<FWPlayerCacheAction *> *)cachedDataActionsForRange:(NSRange)range;
    - (NSData *)cachedDataForRange:(NSRange)range error:(NSError **)error;
    
    - (void)setContentInfo:(FWPlayerCacheContentInfo *)contentInfo error:(NSError **)error;
    
    - (void)save;
    
    - (void)startWritting;
    - (void)finishWritting;
    
    @end

FWPopupMenuPath

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWPopupMenuPath : NSObject
    
    + (CAShapeLayer *)maskLayerWithRect:(CGRect)rect
                             rectCorner:(UIRectCorner)rectCorner
                           cornerRadius:(CGFloat)cornerRadius
                             arrowWidth:(CGFloat)arrowWidth
                            arrowHeight:(CGFloat)arrowHeight
                          arrowPosition:(CGFloat)arrowPosition
                         arrowDirection:(FWPopupMenuArrowDirection)arrowDirection;
    
    + (UIBezierPath *)bezierPathWithRect:(CGRect)rect
                              rectCorner:(UIRectCorner)rectCorner
                            cornerRadius:(CGFloat)cornerRadius
                             borderWidth:(CGFloat)borderWidth
                             borderColor:(nullable UIColor *)borderColor
                         backgroundColor:(nullable UIColor *)backgroundColor
                              arrowWidth:(CGFloat)arrowWidth
                             arrowHeight:(CGFloat)arrowHeight
                           arrowPosition:(CGFloat)arrowPosition
                          arrowDirection:(FWPopupMenuArrowDirection)arrowDirection;
    @end

FWPopupMenuDeviceOrientationManager

FWPopupMenuAnimationManager

FWPopupMenu

FWProgressView

FWRefreshPluginImpl

UIScrollView+FWPullRefresh

  • 下拉刷新视图,默认高度60

    Note

    如果indicatorView为自定义指示器时会自动隐藏标题和箭头,仅显示指示器视图
    See more

    Declaration

    Objective-C

    
    @interface FWPullRefreshView : UIView

UIScrollView+FWInfiniteScroll

  • 上拉追加视图,默认高度60

    See more

    Declaration

    Objective-C

    
    @interface FWInfiniteScrollView : UIView
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWRequestAccessory : NSObject <FWRequestAccessory>
    
    @property (nonatomic, copy, nullable) void (^willStartBlock)(id);
    @property (nonatomic, copy, nullable) void (^willStopBlock)(id);
    @property (nonatomic, copy, nullable) void (^didStopBlock)(id);
    
    @end
  • FWRequestAgent handles batch request management. It keeps track of all the batch requests.

    See more

    Declaration

    Objective-C

    
    @interface FWRequestAgent : NSObject
  • SDWebImage图片插件,启用SDWebImage子模块后生效

    See more

    Declaration

    Objective-C

    
    @interface FWSDWebImageImpl : NSObject
  • SceneDelegate基类

    See more

    Declaration

    Objective-C

    
    @interface FWSceneDelegate : UIResponder <UIWindowSceneDelegate>
  • FWSecurityPolicy evaluates server trust against pinned X.509 certificates and public keys over secure connections.

    Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.

    See more

    Declaration

    Objective-C

    
    @interface FWSecurityPolicy : NSObject <NSSecureCoding, NSCopying>
  • FWSegmentedControl

    HMSegmentedControl 1.5.6

    See more

    Declaration

    Objective-C

    
    @interface FWSegmentedControl : UIControl

FWStatistical

  • 事件统计管理器

    Note

    视图从不可见变为可见时曝光开始,触发曝光开始事件(triggerDuration为0); 视图从可见到不可见时曝光结束,视为一次曝光,触发曝光结束事件(triggerDuration大于0)并统计曝光时长。 目前暂未实现曝光时长统计,仅触发开始事件用于统计次数,可自行处理时长统计,注意应用退后台时不计曝光时间。 默认运行模式时,视图快速滚动不计算曝光,可配置runLoopMode快速滚动时也计算曝光
    See more

    Declaration

    Objective-C

    
    @interface FWStatisticalManager : NSObject
  • 事件统计对象

    See more

    Declaration

    Objective-C

    
    @interface FWStatisticalObject : NSObject <NSCopying>
  • Declaration

    Objective-C

    
    @interface FWTagCollectionView : UIView
  • FWTextTagConfig

    See more

    Declaration

    Objective-C

    
    @interface FWTextTagConfig : NSObject
  • FWTextTagCollectionView

    See more

    Declaration

    Objective-C

    @class FWTextTagCollectionView;

FWToastPluginImpl

FWToastView

  • 吐司视图,默认背景色透明

    See more

    Declaration

    Objective-C

    
    @interface FWToastView : UIControl

FWToolbarView

  • 自定义工具栏视图,高度自动布局(总高度toolbarHeight),可设置toolbarHidden隐藏(总高度0)

    根据toolbarPosition自动设置默认高度,可自定义,如下: 顶部:topView,高度为topHeight,可设置topHidden隐藏 中间:menuView,高度为menuHeight,可设置menuHidden隐藏 底部:bottomView,高度为bottomHeight,可设置bottomHidden隐藏

    See more

    Declaration

    Objective-C

    
    @interface FWToolbarView : UIView

FWToolbarMenuView

  • 自定义工具栏菜单视图,支持完全自定义,默认最多只支持左右各两个按钮,如需更多按钮,请自行添加。

    水平分割时,按钮水平等分;非水平分割时,左右侧间距为8,同系统一致

    See more

    Declaration

    Objective-C

    
    @interface FWToolbarMenuView : UIView

FWToolbarTitleView

  • 可作为导航栏标题控件,通过 navigationItem.titleView 来设置。也可当成单独的标题组件,脱离 UIViewController 使用

    默认情况下 titleView 是不支持点击的,如需点击,请把 userInteractionEnabled 设为 YES

    See more

    Declaration

    Objective-C

    
    @interface FWToolbarTitleView : UIControl

FWToolbarButton

  • 自定义工具栏按钮,兼容系统customView方式和自定义方式

    UIBarButtonItem自定义导航栏时最左和最右间距为16,系统导航栏时为8; FWToolbarButton作为customView使用时,会自动调整按钮内间距,和系统表现一致; FWToolbarButton自动适配横竖屏切换,竖屏时默认内间距{8, 8, 8, 8},横屏时默认内间距{0,8,0,8}

    See more

    Declaration

    Objective-C

    
    @interface FWToolbarButton : UIButton
  • FWJSONRequestSerializer is a subclass of FWHTTPRequestSerializer that encodes parameters as JSON using NSJSONSerialization, setting the Content-Type of the encoded request to application/json.

    See more

    Declaration

    Objective-C

    
    @interface FWJSONRequestSerializer : FWHTTPRequestSerializer
  • FWPropertyListRequestSerializer is a subclass of FWHTTPRequestSerializer that encodes parameters as JSON using NSPropertyListSerializer, setting the Content-Type of the encoded request to application/x-plist.

    See more

    Declaration

    Objective-C

    
    @interface FWPropertyListRequestSerializer : FWHTTPRequestSerializer
  • FWHTTPResponseSerializer conforms to the FWURLRequestSerialization & FWURLResponseSerialization protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.

    Any request or response serializer dealing with HTTP is encouraged to subclass FWHTTPResponseSerializer in order to ensure consistent default behavior.

    See more

    Declaration

    Objective-C

    
    @interface FWHTTPResponseSerializer : NSObject <FWURLResponseSerialization>
  • FWJSONResponseSerializer is a subclass of FWHTTPResponseSerializer that validates and decodes JSON responses.

    By default, FWJSONResponseSerializer accepts the following MIME types, which includes the official standard, application/json, as well as other commonly-used types:

    • application/json
    • text/json
    • text/javascript

    In RFC 7159 - Section 8.1, it states that JSON text is required to be encoded in UTF-8, UTF-16, or UTF-32, and the default encoding is UTF-8. NSJSONSerialization provides support for all the encodings listed in the specification, and recommends UTF-8 for efficiency. Using an unsupported encoding will result in serialization error. See the NSJSONSerialization documentation for more details.

    See more

    Declaration

    Objective-C

    
    @interface FWJSONResponseSerializer : FWHTTPResponseSerializer
  • FWXMLParserResponseSerializer is a subclass of FWHTTPResponseSerializer that validates and decodes XML responses as an NSXMLParser objects.

    By default, FWXMLParserResponseSerializer accepts the following MIME types, which includes the official standard, application/xml, as well as other commonly-used types:

    • application/xml
    • text/xml

    Declaration

    Objective-C

    
    @interface FWXMLParserResponseSerializer : FWHTTPResponseSerializer
  • FWPropertyListResponseSerializer is a subclass of FWHTTPResponseSerializer that validates and decodes XML responses as an NSXMLDocument objects.

    By default, FWPropertyListResponseSerializer accepts the following MIME types:

    • application/x-plist
    See more

    Declaration

    Objective-C

    
    @interface FWPropertyListResponseSerializer : FWHTTPResponseSerializer
  • FWImageResponseSerializer is a subclass of FWHTTPResponseSerializer that validates and decodes image responses.

    By default, FWImageResponseSerializer accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage:

    • application/octet-stream
    • image/tiff
    • image/jpeg
    • image/gif
    • image/png
    • image/ico
    • image/x-icon
    • image/bmp
    • image/x-bmp
    • image/x-xbitmap
    • image/x-ms-bmp
    • image/x-win-bitmap
    • image/heic
    • image/heif
    • image/webp
    • image/svg+xml
    See more

    Declaration

    Objective-C

    
    @interface FWImageResponseSerializer : FWHTTPResponseSerializer
  • FWCompoundSerializer is a subclass of FWHTTPResponseSerializer that delegates the response serialization to the first FWHTTPResponseSerializer object that returns an object for responseObjectForResponse:data:error:, falling back on the default behavior of FWHTTPResponseSerializer. This is useful for supporting multiple potential types and structures of server responses with a single serializer.

    See more

    Declaration

    Objective-C

    
    @interface FWCompoundResponseSerializer : FWHTTPResponseSerializer
  • FWURLSessionManager creates and manages an NSURLSession object based on a specified NSURLSessionConfiguration object, which conforms to <NSURLSessionTaskDelegate>, <NSURLSessionDataDelegate>, <NSURLSessionDownloadDelegate>, and <NSURLSessionDelegate>.

    Subclassing Notes

    This is the base class for FWHTTPSessionManager, which adds functionality specific to making HTTP requests. If you are looking to extend FWURLSessionManager specifically for HTTP, consider subclassing FWHTTPSessionManager instead.

    NSURLSession & NSURLSessionTask Delegate Methods

    FWURLSessionManager implements the following delegate methods:

    NSURLSessionDelegate

    • URLSession:didBecomeInvalidWithError:
    • URLSession:didReceiveChallenge:completionHandler:
    • URLSessionDidFinishEventsForBackgroundURLSession:

    NSURLSessionTaskDelegate

    • URLSession:willPerformHTTPRedirection:newRequest:completionHandler:
    • URLSession:task:didReceiveChallenge:completionHandler:
    • URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:
    • URLSession:task:needNewBodyStream:
    • URLSession:task:didCompleteWithError:

    NSURLSessionDataDelegate

    • URLSession:dataTask:didReceiveResponse:completionHandler:
    • URLSession:dataTask:didBecomeDownloadTask:
    • URLSession:dataTask:didReceiveData:
    • URLSession:dataTask:willCacheResponse:completionHandler:

    NSURLSessionDownloadDelegate

    • URLSession:downloadTask:didFinishDownloadingToURL:
    • URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:
    • URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:

    If any of these methods are overridden in a subclass, they must call the super implementation first.

    Network Reachability Monitoring

    Network reachability status and change monitoring is available through the reachabilityManager property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See FWNetworkReachabilityManager for more details.

    NSCoding Caveats

    • Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using -initWithCoder: or NSKeyedUnarchiver.

    NSCopying Caveats

    • -copy and -copyWithZone: return a new manager with a new NSURLSession created from the configuration of the original.
    • Operation copies do not include any delegate callback blocks, as they often strongly captures a reference to self, which would otherwise have the unintuitive side-effect of pointing to the original session manager when copied.

    Warning

    Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.

    See more

    Declaration

    Objective-C

    
    @interface FWURLSessionManager
        : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate,
                    NSURLSessionDataDelegate, NSURLSessionDownloadDelegate,
                    NSSecureCoding, NSCopying>
  • 视图控制器拦截器

    See more

    Declaration

    Objective-C

    
    @interface FWViewControllerIntercepter : NSObject
  • 视图控制器管理器

    Note

    框架默认未注册FWViewController协议拦截器,如需全局配置控制器,使用全局自定义block即可
    See more

    Declaration

    Objective-C

    
    @interface FWViewControllerManager : NSObject

FWViewPluginImpl

FWAnimatedTransition

  • 转场动画类,默认透明度变化

    See more

    Declaration

    Objective-C

    
    @interface FWAnimatedTransition
        : UIPercentDrivenInteractiveTransition <
              UIViewControllerAnimatedTransitioning,
              UIViewControllerTransitioningDelegate, UINavigationControllerDelegate>

FWSwipeAnimatedTransition

FWTransformAnimatedTransition

FWPresentationController

  • 自定义展示控制器。默认显示暗色背景动画且弹出视图占满容器,可通过属性自定义

    See more

    Declaration

    Objective-C

    
    @interface FWPresentationController : UIPresentationController

FWPanGestureRecognizer

  • FWPanGestureRecognizer

    Note

    自动处理与滚动视图pan手势在指定方向的冲突,默认设置delegate为自身。如果找到滚动视图则处理之,否则同父类
    See more

    Declaration

    Objective-C

    
    @interface FWPanGestureRecognizer : UIPanGestureRecognizer

FWAutoPurgingImageCache

FWImageDownloader

FWImagePluginImpl

FWWebView

  • WKWebView封装,默认实现进度条、JS弹窗、Cookie管理、自定义User-Agent等

    See more

    Declaration

    Objective-C

    
    @interface FWWebView : WKWebView

FWWebViewCookieManager

FWWebViewBridge

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWWebViewJsBridgeBase : NSObject
    
    @property (weak, nonatomic, nullable) id<FWWebViewJsBridgeDelegate> delegate;
    @property (strong, nonatomic, nullable) NSMutableArray *startupMessageQueue;
    @property (strong, nonatomic, nullable) NSMutableDictionary *responseCallbacks;
    @property (strong, nonatomic, nullable) NSMutableDictionary *messageHandlers;
    @property (copy, nonatomic, nullable) FWJsBridgeErrorHandler errorHandler;
    @property (copy, nonatomic, nullable) FWJsBridgeFilterHandler filterHandler;
    
    + (void)enableLogging;
    + (void)setLogMaxLength:(int)length;
    - (void)reset;
    - (void)sendData:(nullable id)data responseCallback:(nullable FWJsBridgeResponseCallback)responseCallback handlerName:(nullable NSString *)handlerName;
    - (void)flushMessageQueue:(NSString *)messageQueueString;
    - (void)injectJavascriptFile;
    - (BOOL)isWebViewJavascriptBridgeURL:(NSURL *)url;
    - (BOOL)isQueueMessageURL:(NSURL *)url;
    - (BOOL)isBridgeLoadedURL:(NSURL *)url;
    - (void)logUnkownMessage:(NSURL *)url;
    - (NSString *)webViewJavascriptCheckCommand;
    - (NSString *)webViewJavascriptFetchQueyCommand;
    - (void)disableJavscriptAlertBoxSafetyTimeout;
    
    @end
  • WKWebView实现Javascript桥接器

    See more

    Declaration

    Objective-C

    
    @interface FWWebViewJsBridge
        : NSObject <WKNavigationDelegate, FWWebViewJsBridgeDelegate>
  • 支持缩放查看静态图片、live photo、视频的控件 默认显示完整图片或视频,可双击查看放大后的大小,再次双击恢复到初始大小。

    支持通过修改 contentMode 来控制静态图片和 live photo 默认的显示模式,目前仅支持 UIViewContentModeCenter、UIViewContentModeScaleAspectFill、UIViewContentModeScaleAspectFit、UIViewContentModeScaleToFill(仅宽度拉伸),默认为 UIViewContentModeScaleAspectFit。注意这里的显示模式是基于 viewportRect 而言的而非整个 zoomImageView FWZoomImageView 提供最基础的图片预览和缩放功能,其他功能请通过继承来实现。

    See more

    Declaration

    Objective-C

    
    @interface FWZoomImageView : UIView <UIScrollViewDelegate>

FWZoomImageVideoToolbar

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FWZoomImageVideoToolbar : UIView
    
    @property(nonatomic, strong, readonly) UIButton *playButton;
    @property(nonatomic, strong, readonly) UIButton *pauseButton;
    @property(nonatomic, strong, readonly) UISlider *slider;
    @property(nonatomic, strong, readonly) UILabel *sliderLeftLabel;
    @property(nonatomic, strong, readonly) UILabel *sliderRightLabel;
    
    // 可通过调整此属性来调整 toolbar 内部的间距,默认为 {0, 0, 0, 0}
    @property(nonatomic, assign) UIEdgeInsets paddings UI_APPEARANCE_SELECTOR;
    
    // 可通过这些属性修改 video 播放时屏幕底部工具栏的播放/暂停图标
    @property(nonatomic, strong) UIImage *playButtonImage UI_APPEARANCE_SELECTOR;
    @property(nonatomic, strong) UIImage *pauseButtonImage UI_APPEARANCE_SELECTOR;
    
    @end

FWMutableArray

FWAttributedOption

  • NSAttributedString属性封装器

    See more

    Declaration

    Objective-C

    
    @interface FWAttributedOption : NSObject <NSCopying>

FWMutableDictionary

FWGradientView

  • 渐变View,无需设置渐变Layer的frame等,支持自动布局

    See more

    Declaration

    Objective-C

    
    @interface FWGradientView : UIView

TabBarController

TabBar

  • FWTabBar是高度自定义的UITabBar子类,通过添加UIControl的方式实现自定义tabBarItem的效果。目前支持tabBar的大部分属性的设置,例如delegate,items,selectedImge,itemPositioning,itemWidth,itemSpacing等,以后会更加细致的优化tabBar原有属性的设置效果。

    See more

    Declaration

    Swift

    @objc(FWTabBar)
    @objcMembers
    open class TabBar : UITabBar

TabBarItem

  • FWTabBarItem inherits from UITabBarItem, the purpose is to provide UITabBarItem property settings for FWTabBarItemContentView. Support most commonly used attributes, such as image, selectedImage, title, tag etc.

    Unsupport properties: MARK: UIBarItem properties 1. var landscapeImagePhone: UIImage? 2. var imageInsets: UIEdgeInsets 3. var landscapeImagePhoneInsets: UIEdgeInsets 4. func setTitleTextAttributes(_ attributes: [String : Any]?, for state: UIControlState) 5. func titleTextAttributes(for state: UIControlState) -> [String : Any]? MARK: UITabBarItem properties 1. func setBadgeTextAttributes(_ textAttributes: [String : Any]?, for state: UIControlState) 2. func badgeTextAttributes(for state: UIControlState) -> [String : Any]?

    See more

    Declaration

    Swift

    @objc(FWTabBarItem)
    @objcMembers
    open class TabBarItem : UITabBarItem

TabBarItemContentView

  • Undocumented

    See more

    Declaration

    Swift

    @objc(FWTabBarItemContentView)
    @objcMembers
    open class TabBarItemContentView : UIView

TabBarItemMoreContentView

TabBarItemBadgeView

  • FWTabBarItemBadgeView 这个类定义了item中使用的badge视图样式,默认为FWTabBarItemBadgeView类对象。 你可以设置FWTabBarItemContentView的badgeView属性为自定义的FWTabBarItemBadgeView子类,这样就可以轻松实现 自定义通知样式了。

    See more

    Declaration

    Swift

    @objc(FWTabBarItemBadgeView)
    @objcMembers
    open class TabBarItemBadgeView : UIView

VideoPlayer

VideoPlayerView

  • Undocumented

    See more

    Declaration

    Swift

    @objc(FWVideoPlayerView)
    @objcMembers
    open class VideoPlayerView : UIView
  • The protocol which can be used to send Mocked data back. Use the Mocker to register Mock data

    See

    Mocker
    See more

    Declaration

    Swift

    open class NetworkMockerURLProtocol : URLProtocol

PagingListContainerView

  • Undocumented

    See more

    Declaration

    Swift

    @objc(FWPagingListContainerView)
    @objcMembers
    open class PagingListContainerView : UIView
    extension PagingListContainerView: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout

PagingMainTableView

  • Undocumented

    See more

    Declaration

    Swift

    @objc(FWPagingMainTableView)
    @objcMembers
    open class PagingMainTableView : UITableView, UIGestureRecognizerDelegate

PagingView

PagingListRefreshView

PagingSmoothView

  • Undocumented

    See more

    Declaration

    Swift

    @objc(FWPagingSmoothView)
    @objcMembers
    open class PagingSmoothView : UIView
    extension PagingSmoothView: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout
  • Undocumented

    See more

    Declaration

    Swift

    @objc(FWPagingSmoothCollectionView)
    @objcMembers
    public class PagingSmoothCollectionView : UICollectionView, UIGestureRecognizerDelegate

Class properties and initialization

  • Class: FWSignatureView

    Accepts touches and draws an image to an UIView

    Description

    This is an UIView based class for capturing a signature drawn by a finger in iOS.

    Usage

    Add the FWSignatureDelegate to the view to exploit the optional delegate methods

    • startedDrawing(_ view: FWSignatureView)
    • finishedDrawing(_ view: FWSignatureView)
    • Add an @IBOutlet, and set its delegate to self
    • Clear the signature field by calling clear() to it
    • Retrieve the signature from the field by either calling
    • getSignature() or
    • getCroppedSignature() ## See https://github.com/GJNilsen/YPDrawSignatureView
    See more

    Declaration

    Swift

    @IBDesignable
    @objc(FWSignatureView)
    @objcMembers
    final public class SignatureView : UIView

SkeletonAnimation

SkeletonAppearance

  • 骨架屏通用样式

    See more

    Declaration

    Swift

    @objc(FWSkeletonAppearance)
    @objcMembers
    public class SkeletonAppearance : NSObject

SkeletonView

  • 骨架屏视图,支持设置占位图片

    See more

    Declaration

    Swift

    @objc(FWSkeletonView)
    @objcMembers
    open class SkeletonView : UIView

SkeletonLabel

  • 骨架屏多行标签视图,可显示多行骨架

    See more

    Declaration

    Swift

    @objc(FWSkeletonLabel)
    @objcMembers
    open class SkeletonLabel : SkeletonView

SkeletonLayout

  • 骨架屏布局视图,可从视图生成骨架屏,嵌套到UIScrollView即可实现滚动

    See more

    Declaration

    Swift

    @objc(FWSkeletonLayout)
    @objcMembers
    open class SkeletonLayout : SkeletonView

SkeletonTableView

  • 骨架屏表格视图,可生成表格骨架屏

    See more

    Declaration

    Swift

    @objc(FWSkeletonTableView)
    @objcMembers
    open class SkeletonTableView : SkeletonLayout, UITableViewDataSource, UITableViewDelegate

SkeletonCollectionView

  • 骨架屏集合视图,可生成集合骨架屏

    See more

    Declaration

    Swift

    @objc(FWSkeletonCollectionView)
    @objcMembers
    open class SkeletonCollectionView : SkeletonLayout, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout

OcrObject

  • OCR扫描结果对象

    See more

    Declaration

    Swift

    @objc(FWOcrObject)
    @objcMembers
    public class OcrObject : NSObject

CollectionViewDelegate

  • 便捷集合视图代理

    See more

    Declaration

    Swift

    @objc(FWCollectionViewDelegate)
    @objcMembers
    open class CollectionViewDelegate : NSObject, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout

TableViewDelegate

  • 便捷表格视图代理

    See more

    Declaration

    Swift

    @objc(FWTableViewDelegate)
    @objcMembers
    open class TableViewDelegate : NSObject, UITableViewDataSource, UITableViewDelegate
  • Lottile插件视图,可用于加载、进度、下拉刷新等

    See more

    Declaration

    Swift

    @objc(FWLottieView)
    @objcMembers
    open class LottieView : UIView, IndicatorViewPlugin, ProgressViewPlugin

HostingController

  • SwiftUI控制器包装类,可将View事件用delegate代理到VC

    Controller在MVVM中也为View的角色,可持有ViewModel,负责生命周期和界面跳转

    See more

    Declaration

    Swift

    @available(iOS 13.0, *)
    open class HostingController : UIHostingController<AnyView>
  • ViewModel基类,被View持有(Controller和View都视为View层),负责处理数据并通知View,兼容UIKit使用 注意:iOS13系统使用时不能继承ViewModel,需直接实现ObservableObject协议,否则\@Published监听不会触发View刷新

    \@State: 内部值传递,赋值时会触发View刷新 \@Binding: 外部引用传递,实现向外传递引用 \@ObservableObject: 可被订阅的对象,属性标记@Published时生效 \@ObservedObject: View订阅监听,收到通知时刷新View,不被View持有,随时可能被销毁,适合外部数据 \@EnvironmentObject: 全局环境对象,使用environmentObject方法绑定,View及其子层级可直接读取 \@StateObject: View引用对象,生命周期和View保持一致,刷新时数据会保持直到View被销毁

    See more

    Declaration

    Swift

    @available(iOS 13.0, *)
    open class ViewModel : ObservableObject

HostingView

  • SwiftUI视图包装类

    SwiftUIX

    See more

    Declaration

    Swift

    @available(iOS 13.0, *)
    open class HostingView<Content> : UIView where Content : View
  • 视图上下文

    See more

    Declaration

    Swift

    @available(iOS 13.0, *)
    public class ViewContext : ObservableObject

UIKitIntrospectionViewController

  • Introspection UIViewController that is inserted alongside the target view controller.

    Declaration

    Swift

    @available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
    public class IntrospectionUIViewController : UIViewController

UIKitIntrospectionView

  • Introspection UIView that is inserted alongside the target view.

    Declaration

    Swift

    @available(iOS 13.0, *)
    public class IntrospectionUIView : UIView

ViewPreferenceKey

  • 通用视图配置Key类

    See more

    Declaration

    Swift

    @available(iOS 13.0, *)
    open class ViewPreferenceKey<T> : PreferenceKey where T : Equatable

ResizableView

  • 可调整大小的视图包装器,解决frame尺寸变为图片尺寸等问题

    See more

    Declaration

    Swift

    @available(iOS 13.0, *)
    public class ResizableView<Content> : UIView where Content : UIView