Protocols

The following protocols are available globally.

AutoloadProtocol

  • Swift自动加载协议,配合autoload(_:)方法使用

    See more

    Declaration

    Swift

    public protocol AutoloadProtocol

ConfigurationTemplateProtocol

LoggerPlugin

ModuleProtocol

  • 业务模块协议,各业务必须实现

    See more

    Declaration

    Swift

    public protocol ModuleProtocol : UIApplicationDelegate

AnyParameter

PluginProtocol

  • 插件协议,可不实现。未实现时默认调用SingletonProtocol > sharedInstance > init方法

    See more

    Declaration

    Swift

    public protocol PluginProtocol

SingletonProtocol

  • 单例协议,可不实现。未实现时默认调用sharedInstance > init方法

    See more

    Declaration

    Swift

    public protocol SingletonProtocol

ObjectType

LockingProtocol

WrapperCompatible

  • 属性包装器兼容协议

    自定义wrapperExtension为任意名称(如app)示例:

    extension WrapperCompatible {
        public static var app: Wrapper<Self>.Type { get { wrapperExtension } set {} }
        public var app: Wrapper<Self> { get { wrapperExtension } set {} }
    }
    

    使用示例:

    String.app.jsonEncode(object)
    
    See more

    Declaration

    Swift

    public protocol WrapperCompatible

CollectionDelegateControllerProtocol

CollectionViewControllerProtocol

PopupViewControllerProtocol

RequestViewControllerProtocol

ScrollViewControllerProtocol

TableDelegateControllerProtocol

TableViewControllerProtocol

ViewControllerProtocol

WebViewControllerProtocol

  • 网页视图控制器协议,可覆写

    WebViewControllerProtocol默认未开启WebView重用,如需开启,方式如下:

    1. 只需配置WebView.reuseConfigurationBlock并设置ViewControllerManager.webViewReuseIdentifier不为nil即可
    2. 其他初始化、预加载、回收等重用操作框架会自动处理,详见源码
    3. 如果需要预缓存资源,配置WebView.reusePreloadUrlBlock后再设置webViewReuseIdentifier即可
    See more

    Declaration

    Swift

    @MainActor
    public protocol WebViewControllerProtocol : ViewControllerProtocol, WebViewDelegate

AttributedLabel

AttributedLabelURLDetector

BadgeView

BannerView

CollectionViewSectionConfig

CollectionViewWaterfallLayout

DrawerView

  • 抽屉拖拽视图事件代理

    See more

    Declaration

    Swift

    @MainActor
    public protocol DrawerViewDelegate : AnyObject

PageControl

  • 分页控件事件代理

    See more

    Declaration

    Swift

    @MainActor
    public protocol PageControlDelegate : NSObjectProtocol

DotView

ReusableViewPool

ScanCode

ToolbarTitleView

SetupViewProtocol

  • 通用视图初始化协议,init自动调用

    渲染数据规范示例:

    1. 无需外部数据时,实现 setupData() ,示例如下:

      func setupData() {
      ...
      }
      
    2. 需外部数据时,实现:configure(…),示例如下:

      func configure(model: Model) {
      ...
      }
      
    See more

    Declaration

    Swift

    @MainActor
    public protocol SetupViewProtocol

EventViewProtocol

  • 通用事件视图代理,可继承也可直接使用

    See more

    Declaration

    Swift

    @MainActor
    public protocol EventViewDelegate : AnyObject
  • 通用事件视图协议,可选使用

    See more

    Declaration

    Swift

    @MainActor
    public protocol EventViewProtocol

WebView

  • WebView事件代理协议

    See more

    Declaration

    Swift

    @MainActor
    public protocol WebViewDelegate : WKNavigationDelegate, WKUIDelegate
  • 可监听ViewModel协议,被View持有(Controller和View都视为View层),负责处理数据并通知View,兼容UIKit和SwiftUI使用

    Declaration

    Swift

    public protocol ObservableViewModel : ObservableObject

AlertController

AlertPlugin

  • 弹窗插件协议,应用可自定义弹窗实现

    See more

    Declaration

    Swift

    @MainActor
    public protocol AlertPlugin : AnyObject

EmptyPlugin

  • 空界面插件协议,应用可自定义空界面插件实现

    See more

    Declaration

    Swift

    @MainActor
    public protocol EmptyPlugin : AnyObject

EmptyViewDelegate

  • 空界面代理协议

    See more

    Declaration

    Swift

    @MainActor
    public protocol EmptyViewDelegate : AnyObject

AutoPurgingImageCache

ImagePlugin

  • 图片插件协议,应用可自定义图片插件

    See more

    Declaration

    Swift

    public protocol ImagePlugin : AnyObject
  • 裁剪控制器事件代理协议

    See more

    Declaration

    Swift

    @MainActor
    @objc
    public protocol ImageCropControllerDelegate : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Swift

    @MainActor
    public protocol ImageCropViewDelegate : AnyObject

ImageAlbumController

ImagePickerPreviewController

ImagePickerController

ImagePickerTitleView

ImagePickerPlugin

  • 图片选取插件协议,应用可自定义图片选取插件实现

    See more

    Declaration

    Swift

    @MainActor
    public protocol ImagePickerPlugin : AnyObject

ImagePreviewView

ImagePreviewPlugin

  • 图片预览插件协议,应用可自定义图片预览插件实现

    See more

    Declaration

    Swift

    @MainActor
    public protocol ImagePreviewPlugin : AnyObject
  • ZoomImageView事件代理

    See more

    Declaration

    Swift

    @MainActor
    @objc
    public protocol ZoomImageViewDelegate

RefreshPlugin

  • 刷新插件协议,应用可自定义刷新插件实现

    See more

    Declaration

    Swift

    @MainActor
    public protocol RefreshPlugin : AnyObject

ToastPlugin

  • 吐司插件协议,应用可自定义吐司插件实现

    See more

    Declaration

    Swift

    @MainActor
    public protocol ToastPlugin : AnyObject

IndicatorViewAnimation

ProgressViewPlugin

  • 自定义进度条视图插件

    See more

    Declaration

    Swift

    @MainActor
    public protocol ProgressViewPlugin : AnyObject

IndicatorViewPlugin

  • 自定义指示器视图协议

    See more

    Declaration

    Swift

    @MainActor
    public protocol IndicatorViewPlugin : AnyObject

ViewPlugin

  • 视图插件协议

    See more

    Declaration

    Swift

    @MainActor
    public protocol ViewPlugin : AnyObject

CacheProtocol

  • 缓存调用协议。复杂对象需遵循NSCoding|AnyArchivable协议

    See more

    Declaration

    Swift

    public protocol CacheProtocol

CacheEngineProtocol

  • 缓存引擎内部协议。复杂对象需遵循NSCoding|AnyArchivable协议

    See more

    Declaration

    Swift

    public protocol CacheEngineProtocol

AnyModel

  • 通用编码模型协议,默认兼容BasicTypelJSON|CodableMode|JSONModel,可扩展

    See more

    Declaration

    Swift

    public protocol AnyModel : ObjectType

CodableModel

  • 通用Codable模型协议,默认未实现KeyMappable,使用方式同Codable一致; CodableModel可实现KeyMappable,并选择以下模式使用,推荐方式

    KeyMappable模式一:MappedValue模式

    1. 支持Codable类型字段,使用方式:@MappedValue
    2. 支持多字段映射,使用方式:@MappedValue(“name1”, “name2”)
    3. 支持Any类型字段,使用方式:@MappedValue
    4. 未标记MappedValue的字段将自动忽略,也可代码忽略:@MappedValue(ignored: true)

    KeyMappable模式二:MappedValueMacro模式(需引入FWPluginMacros子模块)

    1. 标记class或struct为自动映射存储属性宏,使用方式:@MappedValueMacro
    2. 可自定义字段映射规则,使用方式:@MappedValue(“name1”, “name2”)
    3. 以下划线开头或结尾的字段将自动忽略,也可代码忽略:@MappedValue(ignored: true)

    KeyMappable模式三:自定义模式

    1. 需完整实现Codable协议的encode和decode协议方法
    See more

    Declaration

    Swift

    public protocol CodableModel : AnyModel, Decodable, Encodable

KeyMappable

  • 通用Key键名映射协议,兼容Codable、CodableModel、JSONModel,推荐使用

    ExCodable

    See more

    Declaration

    Swift

    public protocol KeyMappable

MappedValue

JSONModel

  • 通用JSON模型协议,默认未实现KeyMappable,使用方式同HandyJSON(不推荐,直接读写内存模式,不稳定也不安全); JSONModel可实现KeyMappable,并选择以下模式使用,推荐方式

    KeyMappable模式一:MappedValue模式

    1. 支持JSONModel类型字段,使用方式:@MappedValue
    2. 支持多字段映射,使用方式:@MappedValue(“name1”, “name2”)
    3. 支持Any类型字段,使用方式:@MappedValue
    4. 未标记MappedValue的字段将自动忽略,也可代码忽略:@MappedValue(ignored: true)

    KeyMappable模式二:MappedValueMacro模式(需引入FWPluginMacros子模块)

    1. 标记class或struct为自动映射存储属性宏,使用方式:@MappedValueMacro
    2. 可自定义字段映射规则,使用方式:@MappedValue(“name1”, “name2”)
    3. 以下划线开头或结尾的字段将自动忽略,也可代码忽略:@MappedValue(ignored: true)

    KeyMappable模式三:自定义模式

    1. 需完整实现JSONModel协议的mappingValue(_:forKey:)协议方法

    HandyJSON

    See more

    Declaration

    Swift

    public protocol JSONModel : AnyModel, _ExtendCustomModelType
  • Undocumented

    Declaration

    Swift

    public protocol JSONModelCustomTransformable : _ExtendCustomBasicType
  • Undocumented

    Declaration

    Swift

    public protocol JSONModelEnum : _RawEnumProtocol

Measuable

  • Undocumented

    Declaration

    Swift

    public protocol _Measurable

Transformable

EnumType

ExtendCustomModelType

ExtendCustomBasicType

TransformType

MappedValue

AnyArchivable

BatchRequest

ChainRequest

HTTPRequest

  • 请求代理

    See more

    Declaration

    Swift

    public protocol RequestDelegate : AnyObject
  • HTTP请求协议,主要用于处理方法中Self参数、错误处理等

    See more

    Declaration

    Swift

    public protocol HTTPRequestProtocol : AnyObject

RequestMultipartFormData

ResponseModelRequest

RequestError

RequestFilter

RequestAccessory

RequestRetrier

RequestValidator

RequestCache

RequestPlugin

AuthorizeProtocol

VideoPlayerDelegate

VideoPlayerPlaybackDelegate

AnyChainable

AnyEncoder

AnyDecoder

AnyDateFormatter

CodableDecodingConverter

DefaultCaseCodable

  • Undocumented

    See more

    Declaration

    Swift

    public protocol DefaultCaseCodable : Decodable, Encodable, RawRepresentable

DynamicLayoutViewProtocol

Subscript

UIView+ResultBuilder

ViewControllerLifecycleObservable

TitleViewProtocol

  • 自定义titleView协议

    See more

    Declaration

    Swift

    @MainActor
    @objc
    public protocol TitleViewProtocol
  • 数据库模型协议信息

    See more

    Declaration

    Swift

    @objc
    public protocol DatabaseModel : NSObjectProtocol

PlayerCacheLoaderManager

PlayerCacheLoader

PlayerCacheDownloader

PlayerCacheRequestWorker

WebSocket

WebSocketServer

Security

Compression

Engine

Transport

Framer

functions for simpler array buffer reading and writing

CollectionViewAlignLayout

BarrageCell

  • Undocumented

    Declaration

    Swift

    public protocol BarrageCellDelegate : CAAnimationDelegate

PagingListContainerView

PagingMainTableView

PagingView

PagingSmoothView

SkeletonAnimation

SkeletonView

StatisticalViewProtocol

  • 可统计视图协议,UIView默认实现,子类可重写

    See more

    Declaration

    Swift

    @MainActor
    @objc
    public protocol StatisticalViewProtocol

Introspect

  • Undocumented

    See more

    Declaration

    Swift

    @MainActor
    public protocol PlatformEntity : AnyObject

IntrospectableViewType

PlatformVersion