Protocols
The following protocols are available globally.
-
Swift自动加载协议,配合autoload(_:)方法使用
See moreDeclaration
Swift
public protocol AutoloadProtocol
-
配置模板协议,配置模板类需实现
See moreDeclaration
Swift
public protocol ConfigurationTemplateProtocol
-
日志插件协议
See moreDeclaration
Swift
public protocol LoggerPlugin
-
业务模块协议,各业务必须实现
See moreDeclaration
Swift
public protocol ModuleProtocol : UIApplicationDelegate
-
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 ArrayParameter<E> : AnyParameter
-
Undocumented
See moreDeclaration
Swift
public protocol DictionaryParameter<K, V> : AnyParameter
-
Undocumented
See moreDeclaration
Swift
public protocol ObjectParameter : DictionaryParameter, ObjectType
-
插件协议,可不实现。未实现时默认调用SingletonProtocol > sharedInstance > init方法
See moreDeclaration
Swift
public protocol PluginProtocol
-
单例协议,可不实现。未实现时默认调用sharedInstance > init方法
See moreDeclaration
Swift
public protocol SingletonProtocol
-
Undocumented
See moreDeclaration
Swift
public protocol ObjectType
-
Undocumented
See moreDeclaration
Swift
public protocol BasicType : ObjectType
-
通用互斥锁协议
See moreDeclaration
Swift
public protocol LockingProtocol
-
属性包装器兼容协议
自定义wrapperExtension为任意名称(如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
-
集合代理控制器协议,数据源和事件代理为collectionDelegate,可覆写
See moreDeclaration
Swift
@MainActor public protocol CollectionDelegateControllerProtocol : ViewControllerProtocol, UICollectionViewDelegate
-
集合视图控制器协议,数据源和事件代理为控制器,可覆写
Declaration
Swift
@MainActor public protocol CollectionViewControllerProtocol : CollectionDelegateControllerProtocol, UICollectionViewDataSource
-
弹窗视图控制器协议,可覆写
See moreDeclaration
Swift
@MainActor public protocol PopupViewControllerProtocol : ViewControllerProtocol
-
通用请求视图控制器协议,可扩展重写
See moreDeclaration
Swift
@MainActor public protocol RequestViewControllerProtocol
-
滚动视图控制器协议,可覆写
See moreDeclaration
Swift
@MainActor public protocol ScrollViewControllerProtocol : ViewControllerProtocol
-
表格代理控制器协议,数据源和事件代理为tableDelegate,可覆写
See moreDeclaration
Swift
@MainActor public protocol TableDelegateControllerProtocol : ViewControllerProtocol, UITableViewDelegate
-
表格视图控制器协议,数据源和事件代理为控制器,可覆写
Declaration
Swift
@MainActor public protocol TableViewControllerProtocol : TableDelegateControllerProtocol, UITableViewDataSource
-
Declaration
Swift
@MainActor public protocol ViewControllerProtocol : ViewControllerLifecycleObservable
-
网页视图控制器协议,可覆写
WebViewControllerProtocol默认未开启WebView重用,如需开启,方式如下:
- 只需配置WebView.reuseConfigurationBlock并设置ViewControllerManager.webViewReuseIdentifier不为nil即可
- 其他初始化、预加载、回收等重用操作框架会自动处理,详见源码
- 如果需要预缓存资源,配置WebView.reusePreloadUrlBlock后再设置webViewReuseIdentifier即可
Declaration
Swift
@MainActor public protocol WebViewControllerProtocol : ViewControllerProtocol, WebViewDelegate
-
Undocumented
See moreDeclaration
Swift
@MainActor public protocol AttributedLabelDelegate : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol AttributedLabelURLDetectorProtocol : AnyObject
-
提醒灯视图协议
See moreDeclaration
Swift
@MainActor public protocol BadgeViewProtocol
-
Banner视图事件代理
See moreDeclaration
Swift
@MainActor @objc public protocol BannerViewDelegate
-
通用布局section配置协议
See moreDeclaration
Swift
@MainActor @objc public protocol CollectionViewDelegateFlowLayout : UICollectionViewDelegateFlowLayout
-
Undocumented
See moreDeclaration
Swift
@MainActor @objc public protocol CollectionViewDelegateWaterfallLayout : UICollectionViewDelegate
-
抽屉拖拽视图事件代理
See moreDeclaration
Swift
@MainActor public protocol DrawerViewDelegate : AnyObject
-
分页控件事件代理
See moreDeclaration
Swift
@MainActor public protocol PageControlDelegate : NSObjectProtocol
-
可重用视图协议
See moreDeclaration
Swift
@MainActor public protocol ReusableViewProtocol
-
Undocumented
See moreDeclaration
Swift
public protocol ScanCodeDelegate : AnyObject
-
Undocumented
See moreDeclaration
Swift
public protocol ScanCodeSampleBufferDelegate : AnyObject
-
Undocumented
See moreDeclaration
Swift
@MainActor @objc public protocol TagCollectionViewDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Swift
@MainActor public protocol TagCollectionViewDataSource : AnyObject
-
Undocumented
See moreDeclaration
Swift
@MainActor @objc public protocol TextTagCollectionViewDelegate
-
自定义titleView事件代理
See moreDeclaration
Swift
@MainActor @objc public protocol ToolbarTitleViewDelegate
-
通用视图初始化协议,init自动调用
渲染数据规范示例:
无需外部数据时,实现 setupData() ,示例如下:
func setupData() { ... }
需外部数据时,实现:configure(…),示例如下:
func configure(model: Model) { ... }
Declaration
Swift
@MainActor public protocol SetupViewProtocol
-
WebView事件代理协议
See moreDeclaration
Swift
@MainActor public protocol WebViewDelegate : WKNavigationDelegate, WKUIDelegate
-
可监听ViewModel协议,被View持有(Controller和View都视为View层),负责处理数据并通知View,兼容UIKit和SwiftUI使用
Declaration
Swift
public protocol ObservableViewModel : ObservableObject
-
自定义弹窗控制器事件代理
See moreDeclaration
Swift
@MainActor @objc public protocol AlertControllerDelegate
-
弹窗插件协议,应用可自定义弹窗实现
See moreDeclaration
Swift
@MainActor public protocol AlertPlugin : AnyObject
-
空界面插件协议,应用可自定义空界面插件实现
See moreDeclaration
Swift
@MainActor public protocol EmptyPlugin : AnyObject
-
空界面代理协议
See moreDeclaration
Swift
@MainActor public protocol EmptyViewDelegate : AnyObject
-
图片缓存协议
See moreDeclaration
Swift
public protocol ImageCache
-
图片请求缓存协议
See moreDeclaration
Swift
public protocol ImageRequestCache : ImageCache
-
图片插件协议,应用可自定义图片插件
See moreDeclaration
Swift
public protocol ImagePlugin : AnyObject
-
裁剪控制器事件代理协议
See moreDeclaration
Swift
@MainActor @objc public protocol ImageCropControllerDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Swift
@MainActor public protocol ImageCropViewDelegate : AnyObject
-
相册列表事件代理
See moreDeclaration
Swift
@MainActor @objc public protocol ImageAlbumControllerDelegate
-
Undocumented
See moreDeclaration
Swift
@MainActor @objc public protocol ImagePickerPreviewControllerDelegate
-
Undocumented
See moreDeclaration
Swift
@MainActor @objc public protocol ImagePickerControllerDelegate
-
Undocumented
See moreDeclaration
Swift
@MainActor public protocol ImagePickerTitleViewDelegate : AnyObject
-
图片选取插件协议,应用可自定义图片选取插件实现
See moreDeclaration
Swift
@MainActor public protocol ImagePickerPlugin : AnyObject
-
图片预览视图代理
See moreDeclaration
Swift
@MainActor @objc public protocol ImagePreviewViewDelegate : ZoomImageViewDelegate
-
刷新插件协议,应用可自定义刷新插件实现
See moreDeclaration
Swift
@MainActor public protocol RefreshPlugin : AnyObject
-
吐司插件协议,应用可自定义吐司插件实现
See moreDeclaration
Swift
@MainActor public protocol ToastPlugin : AnyObject
-
自定义指示器视图动画协议
See moreDeclaration
Swift
@MainActor public protocol IndicatorViewAnimationProtocol : AnyObject
-
自定义进度条视图插件
See moreDeclaration
Swift
@MainActor public protocol ProgressViewPlugin : AnyObject
-
自定义指示器视图协议
See moreDeclaration
Swift
@MainActor public protocol IndicatorViewPlugin : AnyObject
-
视图插件协议
See moreDeclaration
Swift
@MainActor public protocol ViewPlugin : AnyObject
-
缓存调用协议。复杂对象需遵循NSCoding|AnyArchivable协议
See moreDeclaration
Swift
public protocol CacheProtocol
-
缓存引擎内部协议。复杂对象需遵循NSCoding|AnyArchivable协议
See moreDeclaration
Swift
public protocol CacheEngineProtocol
-
通用编码模型协议,默认兼容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模式(需引入FWPluginMacros子模块)
- 标记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模式(需引入FWPluginMacros子模块)
- 标记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
-
任意可归档对象协议,兼容UserDefaults | Cache | Database | Keychain | Codable | CodableModel | JSONModel使用
See moreDeclaration
Swift
public protocol AnyArchivable : ObjectType
-
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 RequestMultipartFormData : AnyObject
-
响应模型请求协议
See moreDeclaration
Swift
public protocol ResponseModelRequest
-
请求错误协议,用于错误判断
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
-
请求插件协议
See moreDeclaration
Swift
public protocol RequestPlugin : AnyObject
-
分析上报者协议
See moreDeclaration
Swift
public protocol AnalysisReporter
-
音频播放器事件代理
See moreDeclaration
Swift
@MainActor @objc public protocol AudioPlayerDelegate
-
音频播放器数据源
See moreDeclaration
Swift
@MainActor @objc public protocol AudioPlayerDataSource
-
权限授权协议
See moreDeclaration
Swift
public protocol AuthorizeProtocol
-
Player delegate protocol
See moreDeclaration
Swift
@MainActor @objc public protocol VideoPlayerDelegate
-
Player playback protocol
See moreDeclaration
Swift
@MainActor @objc public protocol VideoPlayerPlaybackDelegate
-
Undocumented
See moreDeclaration
Swift
public protocol AnyChainable
-
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 JSONSubscriptType
-
UIView兼容ArrayResultBuilder
See moreDeclaration
Swift
public protocol ArrayResultBuilderCompatible
-
视图控制器生命周期监听协议
Declaration
Swift
public protocol ViewControllerLifecycleObservable
-
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
-
Undocumented
See moreDeclaration
Swift
public protocol WebSocketCompressionHandler
-
Undocumented
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
-
扩展 UICollectionViewDelegateFlowLayout/NSCollectionViewDelegateFlowLayout 协议, 添加设置水平、竖直方向的对齐方式以及 items 排布方向协议方法
See moreDeclaration
Swift
@MainActor @objc public protocol CollectionViewDelegateAlignLayout : CollectionViewDelegateFlowLayout
-
Undocumented
Declaration
Swift
public protocol BarrageCellDelegate : CAAnimationDelegate
-
Undocumented
See moreDeclaration
Swift
@MainActor @objc public protocol PagingMainTableViewGestureDelegate
-
Undocumented
See moreDeclaration
Swift
@MainActor @objc public protocol PagingViewDelegate
-
Undocumented
See moreDeclaration
Swift
@MainActor @objc public protocol PagingSmoothViewListViewDelegate
-
Undocumented
See moreDeclaration
Swift
@MainActor @objc public protocol PagingSmoothViewDataSource
-
Undocumented
See moreDeclaration
Swift
@MainActor @objc public protocol PagingSmoothViewDelegate
-
骨架屏动画协议
See moreDeclaration
Swift
public protocol SkeletonAnimationProtocol
-
可统计视图协议,UIView默认实现,子类可重写
See moreDeclaration
Swift
@MainActor @objc public protocol StatisticalViewProtocol
-
Undocumented
See moreDeclaration
Swift
@MainActor public protocol PlatformEntity : AnyObject
-
Undocumented
See moreDeclaration
Swift
@MainActor public protocol IntrospectableViewType
-
Undocumented
See moreDeclaration
Swift
public protocol PlatformVersion : Sendable