Classes
The following classes are available globally.
-
FWAlertController样式,继承自FWAlertAppearance
See moreDeclaration
Objective-C
@interface FWAlertControllerAppearance : FWAlertAppearance
-
Undocumented
See moreDeclaration
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 moreDeclaration
Objective-C
@interface FWAlertAnimation : NSObject <UIViewControllerAnimatedTransitioning> + (instancetype)animationIsPresenting:(BOOL)presenting; @end
-
Undocumented
See moreDeclaration
Objective-C
@interface FWAlertControllerImpl : NSObject <FWAlertPlugin> /** 单例模式 */ @property (class, nonatomic, readonly) FWAlertControllerImpl *sharedInstance NS_SWIFT_NAME(shared); /// 自定义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
-
系统弹出框样式配置类,由于系统兼容性,建议优先使用FWAlertController
Note
如果未自定义样式,显示效果和系统一致,不会产生任何影响;框架会先渲染actions动作再渲染cancel动作Declaration
Objective-C
@interface FWAlertAppearance : NSObject
-
默认弹窗插件
See moreDeclaration
Objective-C
@interface FWAlertPluginImpl : NSObject <FWAlertPlugin>
-
动图单帧对象
See moreDeclaration
Objective-C
@interface FWImageFrame : NSObject
-
图片解码器,支持动图
See moreDeclaration
Objective-C
@interface FWImageCoder : NSObject
-
框架内置应用Bundle类,应用可替换
Note
如果主应用存在FWFramework.bundle或主Bundle内包含对应图片|多语言,则优先使用;否则使用框架默认实现。 FWFramework所需本地化翻译如下:完成|关闭|确定|取消|原有,配置同App本地化一致即可,如zh-Hans|en等Declaration
Objective-C
@interface FWAppBundle : FWModuleBundle
-
框架内置应用配置默认模板类
Declaration
Objective-C
@interface FWAppConfigDefaultTemplate : NSObject <FWConfigurationTemplateProtocol>
-
AppDelegate基类
See moreDeclaration
Objective-C
@interface FWAppDelegate : UIResponder <UIApplicationDelegate>
-
Declaration
Objective-C
@interface FWAppearance : NSObject
-
相册里某一个资源的包装对象,该资源可能是图片、视频等。
Note
FWAsset 重写了 isEqual: 方法,只要两个 FWAsset 的 identifier 相同,则认为是同一个对象,以方便在数组、字典等容器中对大量 FWAsset 进行遍历查找等操作。Declaration
Objective-C
@interface FWAsset : NSObject
-
Undocumented
See moreDeclaration
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 这个对象并提供单例的调用方式主要出于下面两点考虑:
- 保存照片/视频的方法较为复杂,为了方便封装系统接口,同时灵活地扩展功能,需要有一个独立对象去管理这些方法。
- 使用 PhotoKit 获取图片,基本都需要一个 PHCachingImageManager 的实例,为了减少消耗, FWAssetManager 单例内部也构建了一个 PHCachingImageManager,并且暴露给外面,方便获取 PHCachingImageManager 的实例。
Declaration
Objective-C
@interface FWAssetManager : NSObject
-
Declaration
Objective-C
@interface FWAttributedLabel : UIView
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
Objective-C
@interface FWAttributedLabelURLDetector : NSObject @property (nonatomic,strong) id<FWAttributedLabelCustomURLDetector> detector; + (instancetype)shared; - (void)detectLinks:(nullable NSString *)plainText completion:(FWAttributedLinkDetectCompletion)completion; @end
-
Undocumented
See moreDeclaration
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
-
Declaration
Objective-C
@interface FWLayoutChain : NSObject
-
自动加载器,处理swift不支持load方法问题
Note
本方案采用objc扩展方法实现,相对于全局扫描类方案性能高(1/200),使用简单 使用方法:新增FWAutoloader扩展objc类方法,以load开头即会自动调用,注意方法名不要重复,建议load+类名+扩展名Declaration
Objective-C
@interface FWAutoloader : NSObject
-
提醒灯视图,默认禁用userInteractionEnabled
See moreDeclaration
Objective-C
@interface FWBadgeView : UIView
-
Declaration
Objective-C
@interface FWBannerView : UIView
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
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
-
Declaration
Objective-C
@interface FWBarrageManager : NSObject { FWBarrageRenderView *_renderView; }
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
Objective-C
@interface FWBarrageTextCell : FWBarrageCell @property (nonatomic, strong) UILabel *textLabel; @property (nonatomic, strong, nullable) FWBarrageTextDescriptor *textDescriptor; @end
-
Undocumented
See moreDeclaration
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
-
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 moreDeclaration
Objective-C
@interface FWBatchRequest : NSObject
-
支持高亮状态的点击手势
See moreDeclaration
Objective-C
@interface FWTapGestureRecognizer : UITapGestureRecognizer
-
缓存引擎基类,自动管理缓存有效期,线程安全
Declaration
Objective-C
@interface FWCacheEngine : NSObject <FWCacheProtocol>
-
文件缓存
See moreDeclaration
Objective-C
@interface FWCacheFile : FWCacheEngine
-
Keychain缓存
See moreDeclaration
Objective-C
@interface FWCacheKeychain : FWCacheEngine
-
FWCacheManager
See moreDeclaration
Objective-C
@interface FWCacheManager : NSObject
-
内存缓存
See moreDeclaration
Objective-C
@interface FWCacheMemory : FWCacheEngine
-
Sqlite缓存
See moreDeclaration
Objective-C
@interface FWCacheSqlite : FWCacheEngine
-
NSUserDefaults缓存
See moreDeclaration
Objective-C
@interface FWCacheUserDefaults : FWCacheEngine
-
FWChainRequest can be used to chain several FWRequest so that one will only starts after another finishes. Note that when used inside FWChainRequest, a single FWRequest will have its own callback and delegate cleared, in favor of the chain request callback.
See moreDeclaration
Objective-C
@interface FWChainRequest : NSObject
-
通用布局section配置类
See moreDeclaration
Objective-C
@interface FWCollectionViewSectionConfig : NSObject
-
系统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 moreDeclaration
Objective-C
@interface FWCollectionViewFlowLayout : UICollectionViewFlowLayout
-
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
andfooterHeight
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.Declaration
Objective-C
@interface FWCollectionViewWaterfallLayout : UICollectionViewLayout
-
在 UICollectionViewFlowLayout/NSCollectionViewFlowLayout 基础上, 自定义 UICollectionView/NSCollectionView 对齐布局
实现以下功能:
- 设置水平方向对齐方式:流式(默认)、流式填充、居左、居中、居右、平铺;
- 设置竖直方向对齐方式:居中(默认)、置顶、置底;
- 设置显示条目排布方向:从左到右(默认)、从右到左。
Declaration
Objective-C
@interface FWCollectionViewAlignLayout : UICollectionViewFlowLayout
-
配置基类,使用时继承即可
默认自动查找模板类名格式优先级如下:
- 当前模块.[配置类]+Template
- 主项目.[配置类]+Template
- 当前模块.[配置类]+DefaultTemplate
Declaration
Objective-C
@interface FWConfiguration : NSObject
-
Declaration
Objective-C
@interface FWDatabaseManager : NSObject
-
抽屉拖拽视图
See moreDeclaration
Objective-C
@interface FWDrawerView : NSObject
-
默认空界面插件
See moreDeclaration
Objective-C
@interface FWEmptyPluginImpl : NSObject <FWEmptyPlugin>
-
通用的空界面控件,布局顺序从上到下依次为:imageView, loadingView, textLabel, detailTextLabel, actionButton
See moreDeclaration
Objective-C
@interface FWEmptyView : UIView
-
Undocumented
Declaration
Objective-C
@interface FWScrollOverlayView : UIView @end
-
框架异常捕获类
See moreDeclaration
Objective-C
@interface FWExceptionManager : NSObject
-
浮动布局视图
Note
做类似 CSS 里的 float:left 的布局,自行使用 addSubview: 将子 View 添加进来即可。 支持通过
contentMode
属性修改子 View 的对齐方式,目前仅支持UIViewContentModeLeft
和UIViewContentModeRight
,默认为UIViewContentModeLeft
Declaration
Objective-C
@interface FWFloatLayoutView : UIView
-
网格视图
Note
用于做九宫格布局,会将内部所有的 subview 根据指定的列数和行高,把每个 item(也即 subview) 拉伸到相同的大小。 支持在 item 和 item 之间显示分隔线,分隔线支持虚线。 注意分隔线是占位的,把 item 隔开,而不是盖在某个 item 上。
Declaration
Objective-C
@interface FWGridView : UIView
-
Declaration
Objective-C
@interface FWHTTPSessionManager : FWURLSessionManager <NSSecureCoding, NSCopying>
-
字体图标抽象基类,子类需继承
Note
Foundation icons: https://zurb.com/playground/foundation-icon-fonts-3#allicons FontAwesome: https://fontawesome.com/ ionicons: https://ionic.io/ionicons/ Octicons: https://primer.style/octicons/ Material: https://google.github.io/material-design-icons/#icons-for-ios
Declaration
Objective-C
@interface FWIcon : NSObject
-
Declaration
Objective-C
@interface FWImageCropController : UIViewController
-
Undocumented
See moreDeclaration
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 moreDeclaration
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 moreDeclaration
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 moreDeclaration
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
-
相册列表默认Cell
See moreDeclaration
Objective-C
@interface FWImageAlbumTableCell : UITableViewCell
-
当前设备照片里的相簿列表,使用方式:
- 使用 init 初始化。
- 指定一个 albumControllerDelegate,并实现 @required 方法。
注意,iOS 访问相册需要得到授权,建议先询问用户授权([FWAssetsManager requestAuthorization:]),通过了再进行 FWImageAlbumController 的初始化工作。
See moreDeclaration
Objective-C
@interface FWImageAlbumController : UIViewController <UITableViewDataSource, UITableViewDelegate>
-
Undocumented
See moreDeclaration
Objective-C
@interface FWImagePickerPreviewController : FWImagePreviewController <UICollectionViewDataSource, UICollectionViewDelegate, FWImagePreviewViewDelegate>
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
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
-
图片选择空间里的九宫格 cell,支持显示 checkbox、饼状进度条及重试按钮(iCloud 图片需要)
See moreDeclaration
Objective-C
@interface FWImagePickerCollectionCell : UICollectionViewCell
-
自定义图片选取插件
See moreDeclaration
Objective-C
@interface FWImagePickerControllerImpl : NSObject <FWImagePickerPlugin>
-
默认图片选取插件
See moreDeclaration
Objective-C
@interface FWImagePickerPluginImpl : NSObject <FWImagePickerPlugin>
-
查看图片的控件,支持横向滚动、放大缩小、loading 及错误语展示,内部使用 UICollectionView 实现横向滚动及 cell 复用,因此与其他普通的 UICollectionView 一样,也可使用 reloadData、collectionViewLayout 等常用方法。
使用方式:
- 使用 initWithFrame: 或 init 方法初始化。
- 设置 delegate。
- 在 delegate 的 numberOfImagesInImagePreviewView: 方法里返回图片总数。
- 在 delegate 的 imagePreviewView:renderZoomImageView:atIndex: 方法里为 zoomImageView.image 设置图片,如果需要,也可调用 [zoomImageView showLoading] 等方法来显示 loading。
- 由于 FWImagePreviewViewDelegate 继承自 FWZoomImageViewDelegate,所以若需要响应单击、双击、长按事件,请实现 FWZoomImageViewDelegate 里的对应方法。
- 若需要从指定的某一张图片开始查看,可使用 currentImageIndex 属性。
Declaration
Objective-C
@interface FWImagePreviewView : UIView <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, FWZoomImageViewDelegate>
-
图片预览控件,主要功能由内部自带的 FWImagePreviewView 提供,由于以 viewController 的形式存在,所以适用于那种在单独界面里展示图片,或者需要从某张目标图片的位置以动画的形式放大进入预览界面的场景。
使用方式:
- 使用 init 方法初始化
- 添加 self.imagePreviewView 的 delegate
- 以 push 或 present 的方式打开界面。如果是 present,则支持 FWImagePreviewTransitioningStyle 里定义的动画。特别地,如果使用 zoom 方式,则需要通过 sourceImageView() 返回一个原界面上的 view 以作为 present 动画的起点和 dismiss 动画的终点。
Declaration
Objective-C
@interface FWImagePreviewController : UIViewController <UIViewControllerTransitioningDelegate>
-
负责处理 FWImagePreviewController 被 present/dismiss 时的动画,如果需要自定义动画效果,可按需修改 animationEnteringBlock、animationBlock、animationCompletionBlock。
See moreDeclaration
Objective-C
@interface FWImagePreviewTransitionAnimator : NSObject <UIViewControllerAnimatedTransitioning>
-
支持按页横向滚动的 UICollectionViewLayout,可切换不同类型的滚动动画。
Warning
item 的大小和布局仅支持通过 UICollectionViewFlowLayout 的 property 系列属性修改,也即每个 item 都应相等。对于通过 delegate 方式返回各不相同的 itemSize、sectionInset 的场景是不支持的。Declaration
Objective-C
@interface FWCollectionViewPagingLayout : UICollectionViewFlowLayout
-
默认图片预览插件
See moreDeclaration
Objective-C
@interface FWImagePreviewPluginImpl : NSObject <FWImagePreviewPlugin>
-
Declaration
Objective-C
@interface FWIndicatorView : UIView <FWIndicatorViewPlugin, FWProgressViewPlugin>
-
通用加载器,添加处理句柄后指定输入即可加载输出结果
See moreDeclaration
Objective-C
@interface FWLoader<__covariant InputType, __covariant OutputType> : NSObject
-
位置服务
Note
注意:Info.plist需要添加NSLocationWhenInUseUsageDescription项 如果请求Always定位,还需添加NSLocationAlwaysUsageDescription项和NSLocationAlwaysAndWhenInUseUsageDescription项 iOS11可通过showsBackgroundLocationIndicator配置是否显示后台定位指示器Declaration
Objective-C
@interface FWLocationManager : NSObject
-
日志记录类。支持设置全局日志级别和自定义FWLoggerPlugin插件
See moreDeclaration
Objective-C
@interface FWLogger : NSObject
-
默认NSLog日志插件
See moreDeclaration
Objective-C
@interface FWLoggerPluginImpl : NSObject <FWLoggerPlugin>
-
FWMarqueeLabel
Note
简易的跑马灯 label 控件,在文字超过 label 可视区域时会自动开启跑马灯效果展示文字,文字滚动时是首尾连接的效果(参考播放音乐时系统锁屏界面顶部的音乐标题)。Warning
lineBreakMode 默认为 NSLineBreakByClipping(UILabel 默认值为 NSLineBreakByTruncatingTail)。Warning
textAlignment 暂不支持 NSTextAlignmentJustified 和 NSTextAlignmentNatural。Warning
会忽略 numberOfLines 属性,强制以 1 来展示。
Declaration
Objective-C
@interface FWMarqueeLabel : UILabel
-
Declaration
Objective-C
@interface FWMediator : NSObject
-
业务模块Bundle基类,各模块可继承
See moreDeclaration
Objective-C
@interface FWModuleBundle : NSObject
-
Ivar信息
See moreDeclaration
Objective-C
@interface FWClassIvarInfo : NSObject
-
Method 信息
See moreDeclaration
Objective-C
@interface FWClassMethodInfo : NSObject
-
属性信息
See moreDeclaration
Objective-C
@interface FWClassPropertyInfo : NSObject
-
Class信息
See moreDeclaration
Objective-C
@interface FWClassInfo : NSObject
-
导航栏样式配置
See moreDeclaration
Objective-C
@interface FWNavigationBarAppearance : NSObject
-
导航管理器
See moreDeclaration
Objective-C
@interface FWNavigator : NSObject
-
FWNetworkAgent is the underlying class that handles actual request generation, serialization and response handling.
See moreDeclaration
Objective-C
@interface FWNetworkAgent : NSObject
-
FWNetworkConfig stored global network-related configurations, which will be used in
See moreFWNetworkAgent
to form and filter requests, as well as caching response.Declaration
Objective-C
@interface FWNetworkConfig : NSObject
-
Undocumented
See moreDeclaration
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
See moreCache-Control
,Last-Modified
, etc. https://github.com/yuantiku/YTKNetworkDeclaration
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 ofFWNetworkReachabilityManager
must be started with-startMonitoring
before reachability status can be determined.Declaration
Objective-C
@interface FWNetworkReachabilityManager : NSObject
-
Declaration
Objective-C
@interface FWPageControl : UIControl
-
Undocumented
See moreDeclaration
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 moreDeclaration
Objective-C
@interface FWPasscodeFlowLayout : UICollectionViewFlowLayout @property (assign, nonatomic) BOOL equalGap; @property (assign, nonatomic) NSInteger itemNum; @property (assign, nonatomic) CGFloat minLineSpacing; - (void)updateLineSpacing; @end
-
Undocumented
See moreDeclaration
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 moreDeclaration
Objective-C
@interface FWPasscodeSecrectImageView : UIView @property (strong, nonatomic) UIImage *image; @property (assign, nonatomic) CGFloat imageWidth; @property (assign, nonatomic) CGFloat imageHeight; @end
-
Undocumented
See moreDeclaration
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 moreDeclaration
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
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
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 moreDeclaration
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
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
Objective-C
@interface FWPlayerCacheAction : NSObject - (instancetype)initWithActionType:(FWPlayerCacheAtionType)actionType range:(NSRange)range; @property (nonatomic) FWPlayerCacheAtionType actionType; @property (nonatomic) NSRange range; @end
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
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
-
Undocumented
See moreDeclaration
Objective-C
@interface FWPlayerCacheSessionManager : NSObject @property (nonatomic, strong, readonly) NSOperationQueue *downloadQueue; + (instancetype)shared; @end
-
Undocumented
See moreDeclaration
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
-
插件管理器类。支持插件冷替换(使用插件前)和热替换(先释放插件)
Note
和Mediator对比如下: Plugin:和业务无关,侧重于工具类、基础设施、可替换,比如Toast、Loading等 Mediator: 和业务相关,侧重于架构、业务功能、模块化,比如用户模块,订单模块等Declaration
Objective-C
@interface FWPluginManager : NSObject
-
Undocumented
See moreDeclaration
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
-
Undocumented
Declaration
Objective-C
@interface FWPopupMenuDeviceOrientationManager : NSObject <FWPopupMenuDeviceOrientationManager> @end
-
Undocumented
Declaration
Objective-C
@interface FWPopupMenuAnimationManager : NSObject<FWPopupMenuAnimationManager> @end
-
Declaration
Objective-C
@interface FWPopupMenu : UIView
-
框架默认进度条视图
See moreDeclaration
Objective-C
@interface FWProgressView : UIView <FWProgressViewPlugin>
-
弱引用代理类,用于解决NSTimer和CADisplayLink中的循环引用target问题(默认NSTimer会强引用target,直到invalidate)
See moreDeclaration
Objective-C
@interface FWWeakProxy : NSProxy
-
弱引用对象容器类,用于解决关联对象weak引用等
See moreDeclaration
Objective-C
@interface FWWeakObject : NSObject
-
Declaration
Objective-C
@interface FWBlockProxy : NSObject
-
事件协议代理基类,可继承重写事件代理方法
See moreDeclaration
Objective-C
@interface FWDelegateProxy : NSObject
-
渐变View,无需设置渐变Layer的frame等,支持自动布局
See moreDeclaration
Objective-C
@interface FWGradientView : UIView
-
默认刷新插件
See moreDeclaration
Objective-C
@interface FWRefreshPluginImpl : NSObject <FWRefreshPlugin>
-
Declaration
Objective-C
@interface FWPullRefreshView : UIView
-
上拉追加视图,默认高度60
See moreDeclaration
Objective-C
@interface FWInfiniteScrollView : UIView
-
Undocumented
See moreDeclaration
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 moreDeclaration
Objective-C
@interface FWRequestAgent : NSObject
-
URL路由上下文
See moreDeclaration
Objective-C
@interface FWRouterContext : NSObject <NSCopying>
-
Declaration
Objective-C
@interface FWRouter : NSObject
-
SceneDelegate基类
See moreDeclaration
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 moreDeclaration
Objective-C
@interface FWSecurityPolicy : NSObject <NSSecureCoding, NSCopying>
-
Declaration
Objective-C
@interface FWSegmentedControl : UIControl
-
状态类
See moreDeclaration
Objective-C
@interface FWStateObject : NSObject
-
状态事件类
See moreDeclaration
Objective-C
@interface FWStateEvent : NSObject
-
状态转换器
See moreDeclaration
Objective-C
@interface FWStateTransition : NSObject
-
Declaration
Objective-C
@interface FWStateMachine : NSObject
-
事件统计管理器
Note
视图从不可见变为可见时曝光开始,触发曝光开始事件(triggerDuration为0); 视图从可见到不可见时曝光结束,视为一次曝光,触发曝光结束事件(triggerDuration大于0)并统计曝光时长。 目前暂未实现曝光时长统计,仅触发开始事件用于统计次数,可自行处理时长统计,注意应用退后台时不计曝光时间。 默认运行模式时,视图快速滚动不计算曝光,可配置runLoopMode快速滚动时也计算曝光Declaration
Objective-C
@interface FWStatisticalManager : NSObject
-
事件统计对象
See moreDeclaration
Objective-C
@interface FWStatisticalObject : NSObject <NSCopying>
-
Declaration
Objective-C
@interface FWTagCollectionView : UIView
-
FWTextTagConfig
See moreDeclaration
Objective-C
@interface FWTextTagConfig : NSObject
-
FWTextTagCollectionView
See moreDeclaration
Objective-C
@class FWTextTagCollectionView;
-
任务管理器,兼容NSBlockOperation和NSInvocationOperation
See moreDeclaration
Objective-C
@interface FWTaskManager : NSObject
-
主题管理器,iOS13+可跟随系统改变
Note
框架默认只拦截了UIView|UIViewController|UIScreen|UIImageView|UILabel类,满足条件会自动触发fwThemeChanged;如果不满足条件或者拦截未生效,需先设置主题上下文fwThemeContext才能生效 注意事项:iOS13以下默认不支持主题切换;如需支持,请使用fwColor相关方法Declaration
Objective-C
@interface FWThemeManager : NSObject
-
主题动态对象,可获取当前主题静态对象
See moreDeclaration
Objective-C
@interface FWThemeObject<__covariant ObjectType> : NSObject
-
线程安全的可变数组,参考自YYKit
Declaration
Objective-C
@interface FWMutableArray<__covariant ObjectType> : NSMutableArray <ObjectType>
-
线程安全的可变字典,参考自YYKit
Declaration
Objective-C
@interface FWMutableDictionary<__covariant KeyType, __covariant ObjectType> : NSMutableDictionary <KeyType, ObjectType>
-
默认吐司插件
See moreDeclaration
Objective-C
@interface FWToastPluginImpl : NSObject <FWToastPlugin>
-
吐司视图,默认背景色透明
See moreDeclaration
Objective-C
@interface FWToastView : UIControl
-
自定义工具栏视图,高度自动布局(总高度toolbarHeight),可设置toolbarHidden隐藏(总高度0)
根据toolbarPosition自动设置默认高度,可自定义,如下: 顶部:topView,高度为topHeight,可设置topHidden隐藏 中间:menuView,高度为menuHeight,可设置menuHidden隐藏 底部:bottomView,高度为bottomHeight,可设置bottomHidden隐藏
See moreDeclaration
Objective-C
@interface FWToolbarView : UIView
-
Declaration
Objective-C
@interface FWToolbarMenuView : UIView
-
可作为导航栏标题控件,通过 navigationItem.titleView 来设置。也可当成单独的标题组件,脱离 UIViewController 使用
默认情况下 titleView 是不支持点击的,如需点击,请把
See moreuserInteractionEnabled
设为YES
Declaration
Objective-C
@interface FWToolbarTitleView : UIControl
-
自定义工具栏按钮,兼容系统customView方式和自定义方式
UIBarButtonItem自定义导航栏时最左和最右间距为16,系统导航栏时为8; FWToolbarButton作为customView使用时,会自动调整按钮内间距,和系统表现一致; FWToolbarButton自动适配横竖屏切换,竖屏时默认内间距{8, 8, 8, 8},横屏时默认内间距{0,8,0,8}
See moreDeclaration
Objective-C
@interface FWToolbarButton : UIButton
-
FWHTTPRequestSerializer
conforms to theFWURLRequestSerialization
&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
See moreFWHTTPRequestSerializer
in order to ensure consistent default behavior.Declaration
Objective-C
@interface FWHTTPRequestSerializer : NSObject <FWURLRequestSerialization>
-
See moreFWJSONRequestSerializer
is a subclass ofFWHTTPRequestSerializer
that encodes parameters as JSON usingNSJSONSerialization
, setting theContent-Type
of the encoded request toapplication/json
.Declaration
Objective-C
@interface FWJSONRequestSerializer : FWHTTPRequestSerializer
-
See moreFWPropertyListRequestSerializer
is a subclass ofFWHTTPRequestSerializer
that encodes parameters as JSON usingNSPropertyListSerializer
, setting theContent-Type
of the encoded request toapplication/x-plist
.Declaration
Objective-C
@interface FWPropertyListRequestSerializer : FWHTTPRequestSerializer
-
FWHTTPResponseSerializer
conforms to theFWURLRequestSerialization
&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
See moreFWHTTPResponseSerializer
in order to ensure consistent default behavior.Declaration
Objective-C
@interface FWHTTPResponseSerializer : NSObject <FWURLResponseSerialization>
-
FWJSONResponseSerializer
is a subclass ofFWHTTPResponseSerializer
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
See moreNSJSONSerialization
documentation for more details.Declaration
Objective-C
@interface FWJSONResponseSerializer : FWHTTPResponseSerializer
-
FWXMLParserResponseSerializer
is a subclass ofFWHTTPResponseSerializer
that validates and decodes XML responses as anNSXMLParser
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 ofFWHTTPResponseSerializer
that validates and decodes XML responses as anNSXMLDocument
objects.By default,
FWPropertyListResponseSerializer
accepts the following MIME types:application/x-plist
Declaration
Objective-C
@interface FWPropertyListResponseSerializer : FWHTTPResponseSerializer
-
FWImageResponseSerializer
is a subclass ofFWHTTPResponseSerializer
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
Declaration
Objective-C
@interface FWImageResponseSerializer : FWHTTPResponseSerializer
-
See moreFWCompoundSerializer
is a subclass ofFWHTTPResponseSerializer
that delegates the response serialization to the firstFWHTTPResponseSerializer
object that returns an object forresponseObjectForResponse:data:error:
, falling back on the default behavior ofFWHTTPResponseSerializer
. This is useful for supporting multiple potential types and structures of server responses with a single serializer.Declaration
Objective-C
@interface FWCompoundResponseSerializer : FWHTTPResponseSerializer
-
FWURLSessionManager
creates and manages anNSURLSession
object based on a specifiedNSURLSessionConfiguration
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 extendFWURLSessionManager
specifically for HTTP, consider subclassingFWHTTPSessionManager
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. SeeFWNetworkReachabilityManager
for more details.NSCoding Caveats
- Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using
-initWithCoder:
orNSKeyedUnarchiver
.
NSCopying Caveats
-copy
and-copyWithZone:
return a new manager with a newNSURLSession
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.
Declaration
Objective-C
@interface FWURLSessionManager : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NSSecureCoding, NSCopying>
-
视图控制器拦截器
See moreDeclaration
Objective-C
@interface FWViewControllerIntercepter : NSObject
-
Declaration
Objective-C
@interface FWViewControllerManager : NSObject
-
默认视图插件
See moreDeclaration
Objective-C
@interface FWViewPluginImpl : NSObject <FWViewPlugin>
-
转场动画类,默认透明度变化
See moreDeclaration
Objective-C
@interface FWAnimatedTransition : UIPercentDrivenInteractiveTransition < UIViewControllerAnimatedTransitioning, UIViewControllerTransitioningDelegate, UINavigationControllerDelegate>
-
滑动转场动画类,默认上下
See moreDeclaration
Objective-C
@interface FWSwipeAnimatedTransition : FWAnimatedTransition
-
形变转场动画类,默认缩放
See moreDeclaration
Objective-C
@interface FWTransformAnimatedTransition : FWAnimatedTransition
-
自定义展示控制器。默认显示暗色背景动画且弹出视图占满容器,可通过属性自定义
See moreDeclaration
Objective-C
@interface FWPresentationController : UIPresentationController
-
Declaration
Objective-C
@interface FWPanGestureRecognizer : UIPanGestureRecognizer
-
内存自动清理图片缓存
See moreDeclaration
Objective-C
@interface FWAutoPurgingImageCache : NSObject <FWImageRequestCache>
-
默认图片插件
See moreDeclaration
Objective-C
@interface FWImagePluginImpl : NSObject <FWImagePlugin>
-
WKWebView封装,默认实现进度条、JS弹窗、Cookie管理、自定义User-Agent等
See moreDeclaration
Objective-C
@interface FWWebView : WKWebView
-
Declaration
Objective-C
@interface FWWebViewCookieManager : NSObject
-
Undocumented
See moreDeclaration
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
-
Declaration
Objective-C
@interface FWWebViewJsBridge : NSObject <WKNavigationDelegate, FWWebViewJsBridgeDelegate>
-
支持缩放查看静态图片、live photo、视频的控件 默认显示完整图片或视频,可双击查看放大后的大小,再次双击恢复到初始大小。
支持通过修改 contentMode 来控制静态图片和 live photo 默认的显示模式,目前仅支持 UIViewContentModeCenter、UIViewContentModeScaleAspectFill、UIViewContentModeScaleAspectFit、UIViewContentModeScaleToFill(仅宽度拉伸),默认为 UIViewContentModeScaleAspectFit。注意这里的显示模式是基于 viewportRect 而言的而非整个 zoomImageView FWZoomImageView 提供最基础的图片预览和缩放功能,其他功能请通过继承来实现。
See moreDeclaration
Objective-C
@interface FWZoomImageView : UIView <UIScrollViewDelegate>
-
Undocumented
See moreDeclaration
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
-
SDWebImage图片插件,启用SDWebImage子模块后生效
See moreDeclaration
Objective-C
@interface FWSDWebImageImpl : NSObject
-
全局包装器(因struct只读,只能用class)
自定义FW为任意名称(如APP)示例: public typealias APP = FW 使用示例: APP.safeString(object)
See more
-
方法交换存储器
See more
-
FWTabBar是高度自定义的UITabBar子类,通过添加UIControl的方式实现自定义tabBarItem的效果。目前支持tabBar的大部分属性的设置,例如delegate,items,selectedImge,itemPositioning,itemWidth,itemSpacing等,以后会更加细致的优化tabBar原有属性的设置效果。
See more
-
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
-
FWTabBarItemBadgeView 这个类定义了item中使用的badge视图样式,默认为FWTabBarItemBadgeView类对象。 你可以设置FWTabBarItemContentView的badgeView属性为自定义的FWTabBarItemBadgeView子类,这样就可以轻松实现 自定义通知样式了。
See more
-
便捷集合视图代理
See more
-
Declaration
Swift
-
Declaration
Swift
-
Declaration
Swift
-
骨架屏自带动画
See more
-
骨架屏通用样式
See more
-
骨架屏视图,支持设置占位图片
See more
-
骨架屏多行标签视图,可显示多行骨架
See more
-
骨架屏布局视图,可从视图生成骨架屏,嵌套到UIScrollView即可实现滚动
See more
-
骨架屏表格视图,可生成表格骨架屏
See more
-
骨架屏集合视图,可生成集合骨架屏
See more
-
便捷表格视图代理
See more
-
权限管理器。由于打包上传ipa时会自动检查隐私库并提供Info.plist描述,所以默认关闭隐私库声明
开启指定权限方法: Pod项目:添加pod时同时指定 pod ‘FWFramework’, :subspecs => [‘Contacts’]
See more
-
Keychain管理器
See more
-
通知管理器
See more
-
版本管理器
See more
-
Declaration
Swift