Protocols
The following protocols are available globally.
-
Swift自动加载协议,配合autoload(_:)方法使用
See moreDeclaration
Swift
public protocol AutoloadProtocol
-
HTTP请求协议,主要用于处理方法中Self参数
See moreDeclaration
Swift
public protocol HTTPRequestProtocol
-
响应模型请求协议
See moreDeclaration
Swift
public protocol ResponseModelRequest
-
配置模板协议,配置模板类需实现
See moreDeclaration
Swift
public protocol ConfigurationTemplateProtocol
-
日志插件协议
See moreDeclaration
Swift
public protocol LoggerPlugin
-
业务模块协议,各业务必须实现
See moreDeclaration
Swift
public protocol ModuleProtocol : UIApplicationDelegate
-
属性包装器兼容协议
自定义fw为任意名称(如app)示例:
extension WrapperCompatible { public static var app: Wrapper<Self>.Type { get { wrapperExtension } set {} } public var app: Wrapper<Self> { get { wrapperExtension } set {} } }
使用示例:
See moreString.app.jsonEncode(object)
Declaration
Swift
public protocol WrapperCompatible
-
插件协议,可不实现。未实现时默认调用SingletonProtocol > sharedInstance > init方法
See moreDeclaration
Swift
public protocol PluginProtocol
-
集合代理控制器协议,数据源和事件代理为collectionDelegate,可覆写
See moreDeclaration
Swift
public protocol CollectionDelegateControllerProtocol : ViewControllerProtocol, UICollectionViewDelegate
-
集合视图控制器协议,数据源和事件代理为控制器,可覆写
Declaration
Swift
public protocol CollectionViewControllerProtocol : CollectionDelegateControllerProtocol, UICollectionViewDataSource
-
滚动视图控制器协议,可覆写
See moreDeclaration
Swift
public protocol ScrollViewControllerProtocol : ViewControllerProtocol
-
表格代理控制器协议,数据源和事件代理为tableDelegate,可覆写
See moreDeclaration
Swift
public protocol TableDelegateControllerProtocol : ViewControllerProtocol, UITableViewDelegate
-
表格视图控制器协议,数据源和事件代理为控制器,可覆写
Declaration
Swift
public protocol TableViewControllerProtocol : TableDelegateControllerProtocol, UITableViewDataSource
-
Declaration
Swift
public protocol ViewControllerProtocol : ViewControllerLifecycleObservable
-
网页视图控制器协议,可覆写
WebViewControllerProtocol默认未开启WebView重用,如需开启,方式如下:
- 只需配置WebView.reuseConfigurationBlock并设置ViewControllerManager.webViewReuseIdentifier不为nil即可
- 其他初始化、预加载、回收等重用操作框架会自动处理,详见源码
- 如果需要预缓存资源,配置WebView.reusePreloadUrlBlock后再设置webViewReuseIdentifier即可
Declaration
Swift
public protocol WebViewControllerProtocol : ViewControllerProtocol, WebViewDelegate
-
通用编码模型协议,默认兼容BasicTypelJSON|CodableMode|JSONModel,可扩展
See moreDeclaration
Swift
public protocol AnyModel : ObjectType
-
通用Codable模型协议,默认未实现KeyMappable,使用方式同Codable一致; CodableModel可实现KeyMappable,并选择以下模式使用,推荐方式
KeyMappable模式一:MappedValue模式
- 支持Codable类型字段,使用方式:@MappedValue
- 支持多字段映射,使用方式:@MappedValue(“name1”, “name2”)
- 支持Any类型字段,使用方式:@MappedValue
- 未标记MappedValue的字段将自动忽略,也可代码忽略:@MappedValue(ignored: true)
KeyMappable模式二:MappedValueMacro模式(需引入FWMacro子模块)
- 标记class或struct为自动映射存储属性宏,使用方式:@MappedValueMacro
- 可自定义字段映射规则,使用方式:@MappedValue(“name1”, “name2”)
- 以下划线开头或结尾的字段将自动忽略,也可代码忽略:@MappedValue(ignored: true)
KeyMappable模式三:自定义模式
- 需完整实现Codable协议的encode和decode协议方法
Declaration
Swift
public protocol CodableModel : AnyModel, Decodable, Encodable
-
Undocumented
See moreDeclaration
Swift
public protocol EncodableMappedValue
-
Undocumented
See moreDeclaration
Swift
public protocol DecodableMappedValue
-
Undocumented
See moreDeclaration
Swift
public protocol EncodableAnyMappedValue
-
Undocumented
See moreDeclaration
Swift
public protocol DecodableAnyMappedValue
-
通用JSON模型协议,默认未实现KeyMappable,使用方式同HandyJSON(不推荐,直接读写内存模式,不稳定也不安全); JSONModel可实现KeyMappable,并选择以下模式使用,推荐方式
KeyMappable模式一:MappedValue模式
- 支持JSONModel类型字段,使用方式:@MappedValue
- 支持多字段映射,使用方式:@MappedValue(“name1”, “name2”)
- 支持Any类型字段,使用方式:@MappedValue
- 未标记MappedValue的字段将自动忽略,也可代码忽略:@MappedValue(ignored: true)
KeyMappable模式二:MappedValueMacro模式(需引入FWMacro子模块)
- 标记class或struct为自动映射存储属性宏,使用方式:@MappedValueMacro
- 可自定义字段映射规则,使用方式:@MappedValue(“name1”, “name2”)
- 以下划线开头或结尾的字段将自动忽略,也可代码忽略:@MappedValue(ignored: true)
KeyMappable模式三:自定义模式
- 需完整实现JSONModel协议的mappingValue(_:forKey:)协议方法
Declaration
Swift
public protocol JSONModel : AnyModel, _ExtendCustomModelType
-
Undocumented
Declaration
Swift
public protocol JSONModelCustomTransformable : _ExtendCustomBasicType
-
Undocumented
Declaration
Swift
public protocol JSONModelEnum : _RawEnumProtocol
-
Undocumented
Declaration
Swift
public protocol _Measurable
-
Undocumented
Declaration
Swift
public protocol _Transformable : _Measurable
-
Undocumented
See moreDeclaration
Swift
public protocol _RawEnumProtocol : _Transformable
-
Undocumented
See moreDeclaration
Swift
public protocol _ExtendCustomModelType : _Transformable
-
Undocumented
See moreDeclaration
Swift
public protocol _ExtendCustomBasicType : _Transformable
-
Undocumented
See moreDeclaration
Swift
public protocol TransformType
-
Undocumented
See moreDeclaration
Swift
public protocol JSONMappedValue
-
Undocumented
See moreDeclaration
Swift
public protocol AttributedLabelDelegate : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol AttributedLabelURLDetectorProtocol : AnyObject
-
提醒灯视图协议
See moreDeclaration
Swift
public protocol BadgeViewProtocol
-
Banner视图事件代理
See moreDeclaration
Swift
@objc public protocol BannerViewDelegate
-
Undocumented
Declaration
Swift
public protocol BarrageCellDelegate : CAAnimationDelegate
-
通用布局section配置协议
See moreDeclaration
Swift
@objc public protocol CollectionViewDelegateFlowLayout : UICollectionViewDelegateFlowLayout
-
扩展 UICollectionViewDelegateFlowLayout/NSCollectionViewDelegateFlowLayout 协议, 添加设置水平、竖直方向的对齐方式以及 items 排布方向协议方法
See moreDeclaration
Swift
@objc public protocol CollectionViewDelegateAlignLayout : CollectionViewDelegateFlowLayout
-
Undocumented
See moreDeclaration
Swift
@objc public protocol CollectionViewDelegateWaterfallLayout : UICollectionViewDelegate
-
抽屉拖拽视图事件代理
See moreDeclaration
Swift
public protocol DrawerViewDelegate : AnyObject
-
分页控件事件代理
See moreDeclaration
Swift
public protocol PageControlDelegate : NSObjectProtocol
-
点视图协议
See moreDeclaration
Swift
public protocol DotViewProtocol
-
Undocumented
See moreDeclaration
Swift
@objc public protocol PagingMainTableViewGestureDelegate
-
Undocumented
See moreDeclaration
Swift
@objc public protocol PagingViewDelegate
-
Undocumented
See moreDeclaration
Swift
@objc public protocol PagingSmoothViewListViewDelegate
-
Undocumented
See moreDeclaration
Swift
@objc public protocol PagingSmoothViewDataSource
-
Undocumented
See moreDeclaration
Swift
@objc public protocol PagingSmoothViewDelegate
-
弹出菜单事件代理
See moreDeclaration
Swift
@objc public protocol PopupMenuDelegate
-
可重用视图协议
See moreDeclaration
Swift
public protocol ReusableViewProtocol
-
骨架屏动画协议
See moreDeclaration
Swift
public protocol SkeletonAnimationProtocol
-
可统计视图协议,UIView默认实现,子类可重写
See moreDeclaration
Swift
@objc public protocol StatisticalViewProtocol
-
Undocumented
See moreDeclaration
Swift
@objc public protocol TagCollectionViewDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Swift
public protocol TagCollectionViewDataSource : AnyObject
-
Undocumented
See moreDeclaration
Swift
@objc public protocol TextTagCollectionViewDelegate
-
WebView事件代理协议
See moreDeclaration
Swift
public protocol WebViewDelegate : WKNavigationDelegate, WKUIDelegate
-
自定义弹窗控制器事件代理
See moreDeclaration
Swift
@objc public protocol AlertControllerDelegate
-
弹窗插件协议,应用可自定义弹窗实现
See moreDeclaration
Swift
public protocol AlertPlugin : AnyObject
-
空界面插件协议,应用可自定义空界面插件实现
See moreDeclaration
Swift
public protocol EmptyPlugin : AnyObject
-
空界面代理协议
See moreDeclaration
Swift
public protocol EmptyViewDelegate : AnyObject
-
相册列表事件代理
See moreDeclaration
Swift
@objc public protocol ImageAlbumControllerDelegate
-
Undocumented
See moreDeclaration
Swift
@objc public protocol ImagePickerPreviewControllerDelegate
-
Undocumented
See moreDeclaration
Swift
@objc public protocol ImagePickerControllerDelegate
-
图片选取插件协议,应用可自定义图片选取插件实现
See moreDeclaration
Swift
public protocol ImagePickerPlugin : AnyObject
-
图片预览视图代理
See moreDeclaration
Swift
@objc public protocol ImagePreviewViewDelegate : ZoomImageViewDelegate
-
刷新插件协议,应用可自定义刷新插件实现
See moreDeclaration
Swift
public protocol RefreshPlugin : AnyObject
-
请求插件协议
See moreDeclaration
Swift
public protocol RequestPlugin : AnyObject
-
吐司插件协议,应用可自定义吐司插件实现
See moreDeclaration
Swift
public protocol ToastPlugin : AnyObject
-
自定义指示器视图动画协议
See moreDeclaration
Swift
public protocol IndicatorViewAnimationProtocol : AnyObject
-
自定义进度条视图插件
See moreDeclaration
Swift
public protocol ProgressViewPlugin : AnyObject
-
自定义指示器视图协议
See moreDeclaration
Swift
public protocol IndicatorViewPlugin : AnyObject
-
权限授权协议
See moreDeclaration
Swift
public protocol AuthorizeProtocol
-
缓存调用协议。复杂对象需遵循NSCoding协议
See moreDeclaration
Swift
public protocol CacheProtocol
-
缓存引擎内部协议。复杂对象需遵循NSCoding协议
See moreDeclaration
Swift
public protocol CacheEngineProtocol
-
Declaration
Swift
public protocol AnyEncoder
-
Undocumented
See moreDeclaration
Swift
public protocol AnyDecoder
-
Undocumented
See moreDeclaration
Swift
public protocol AnyDateFormatter
-
Undocumented
See moreDeclaration
Swift
public protocol CodableDecodingConverter
-
Undocumented
See moreDeclaration
Swift
public protocol DefaultCaseCodable : Decodable, Encodable, RawRepresentable
-
Undocumented
See moreDeclaration
Swift
public protocol ObjectType
-
Undocumented
See moreDeclaration
Swift
public protocol BasicType : ObjectType
-
Undocumented
Declaration
Swift
public protocol AnyParameter
-
Undocumented
See moreDeclaration
Swift
public protocol DataParameter : AnyParameter
-
Undocumented
See moreDeclaration
Swift
public protocol StringParameter : AnyParameter
-
Undocumented
See moreDeclaration
Swift
public protocol AttributedStringParameter : AnyParameter
-
Undocumented
See moreDeclaration
Swift
public protocol URLParameter : AnyParameter
-
Undocumented
See moreDeclaration
Swift
public protocol URLRequestParameter : AnyParameter
-
Undocumented
See moreDeclaration
Swift
public protocol ArrayParameter<E> : AnyParameter
-
Undocumented
See moreDeclaration
Swift
public protocol DictionaryParameter<K, V> : AnyParameter
-
Undocumented
See moreDeclaration
Swift
public protocol ObjectParameter : DictionaryParameter, ObjectType
-
Undocumented
See moreDeclaration
Swift
public protocol JSONSubscriptType
-
数据库模型协议信息
See moreDeclaration
Swift
@objc public protocol DatabaseModel : NSObjectProtocol
-
音频播放器事件代理
See moreDeclaration
Swift
@objc public protocol AudioPlayerDelegate
-
音频播放器数据源
See moreDeclaration
Swift
@objc public protocol AudioPlayerDataSource
-
Undocumented
See moreDeclaration
Swift
public protocol PlayerCacheLoaderManagerDelegate : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol PlayerCacheLoaderDelegate : AnyObject
-
Undocumented
See moreDeclaration
Swift
@objc public protocol PlayerCacheDownloaderDelegate
-
Undocumented
See moreDeclaration
Swift
public protocol PlayerCacheRequestWorkerDelegate : AnyObject
-
Player delegate protocol
See moreDeclaration
Swift
@objc public protocol VideoPlayerDelegate
-
Player playback protocol
See moreDeclaration
Swift
@objc public protocol VideoPlayerPlaybackDelegate
-
图片缓存协议
See moreDeclaration
Swift
public protocol ImageCache
-
图片请求缓存协议
See moreDeclaration
Swift
public protocol ImageRequestCache : ImageCache
-
Undocumented
See moreDeclaration
Swift
public protocol URLRequestSerialization : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol MultipartFormData : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol URLResponseSerialization : AnyObject
-
批量请求代理
See moreDeclaration
Swift
public protocol BatchRequestDelegate : AnyObject
-
队列请求代理
See moreDeclaration
Swift
public protocol ChainRequestDelegate : AnyObject
-
请求代理
See moreDeclaration
Swift
public protocol RequestDelegate : AnyObject
-
请求表单数据定义
See moreDeclaration
Swift
public protocol RequestMultipartFormData : AnyObject
-
请求错误协议,用于错误判断
Declaration
Swift
public protocol RequestErrorProtocol
-
嵌套错误协议,获取内部错误
See moreDeclaration
Swift
public protocol UnderlyingErrorProtocol
-
请求过滤器协议
See moreDeclaration
Swift
public protocol RequestFilterProtocol : AnyObject
-
请求配件
See moreDeclaration
Swift
public protocol RequestAccessoryProtocol : AnyObject
-
请求重试器协议
See moreDeclaration
Swift
public protocol RequestRetrierProtocol : AnyObject
-
请求验证器协议
See moreDeclaration
Swift
public protocol RequestValidatorProtocol : AnyObject
-
请求缓存协议
See moreDeclaration
Swift
public protocol RequestCacheProtocol : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol WebSocketCompressionHandler
-
Undocumented
See moreDeclaration
Swift
public protocol WebSocketFramerEventClient : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol WebSocketFramerProtocol
-
MARK: - functions for simpler array buffer reading and writing
Declaration
Swift
public protocol WebSocketArrayType
-
Undocumented
See moreDeclaration
Swift
public protocol WebSocketFrameCollectorDelegate : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol WebSocketHTTPHandlerDelegate : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol WebSocketHTTPHandler
-
Undocumented
See moreDeclaration
Swift
public protocol WebSocketHTTPServerDelegate : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol WebSocketHTTPServerHandler
-
视图控制器生命周期监听协议
Declaration
Swift
public protocol ViewControllerLifecycleObservable
-
Undocumented
See moreDeclaration
Swift
public protocol PlatformEntity : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol IntrospectableViewType
-
Undocumented
See moreDeclaration
Swift
public protocol PlatformVersion
-
ViewModel协议,被View持有(Controller和View都视为View层),负责处理数据并通知View,兼容UIKit使用 注意:iOS13系统使用时不能继承实现ObservableObject协议的ViewModel类,需直接实现ObservableObject协议,否则\@Published监听不会触发View刷新
\@State: 内部值传递,赋值时会触发View刷新 \@Binding: 外部引用传递,实现向外传递引用 \@ObservableObject: 可被订阅的对象,属性标记@Published时生效 \@ObservedObject: View订阅监听,收到通知时刷新View,不被View持有,随时可能被销毁,适合外部数据 \@EnvironmentObject: 全局环境对象,使用environmentObject方法绑定,View及其子层级可直接读取 \@StateObject: View引用对象,生命周期和View保持一致,刷新时数据会保持直到View被销毁
Declaration
Swift
public protocol ViewModel : ObservableObject