Protocols

The following protocols are available globally.

AutoloadProtocol

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

    See more

    Declaration

    Swift

    public protocol AutoloadProtocol

HTTPRequestProtocol

  • HTTP请求协议,主要用于处理方法中Self参数

    See more

    Declaration

    Swift

    public protocol HTTPRequestProtocol

ResponseModelRequest

ConfigurationTemplateProtocol

LoggerPlugin

ModuleProtocol

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

    See more

    Declaration

    Swift

    public protocol ModuleProtocol : UIApplicationDelegate

WrapperCompatible

  • 属性包装器兼容协议

    自定义fw为任意名称(如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

PluginProtocol

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

    See more

    Declaration

    Swift

    public protocol PluginProtocol

CollectionDelegateControllerProtocol

CollectionViewControllerProtocol

ScrollViewControllerProtocol

TableDelegateControllerProtocol

TableViewControllerProtocol

ViewControllerProtocol

WebViewControllerProtocol

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

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

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

    Declaration

    Swift

    public protocol WebViewControllerProtocol : ViewControllerProtocol, WebViewDelegate

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模式(需引入FWMacro子模块)

    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模式(需引入FWMacro子模块)

    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

AttributedLabel

AttributedLabelURLDetector

BadgeView

BannerView

BarrageCell

  • Undocumented

    Declaration

    Swift

    public protocol BarrageCellDelegate : CAAnimationDelegate

CollectionViewSectionConfig

CollectionViewAlignLayout

CollectionViewWaterfallLayout

DrawerView

PageControl

DotView

PagingListContainerView

PagingMainTableView

PagingView

PagingSmoothView

ReusableViewPool

ScanCode

SkeletonAnimation

SkeletonView

StatisticalViewProtocol

ToolbarTitleView

WebView

  • WebView事件代理协议

    See more

    Declaration

    Swift

    public protocol WebViewDelegate : WKNavigationDelegate, WKUIDelegate

AlertController

AlertPlugin

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

    See more

    Declaration

    Swift

    public protocol AlertPlugin : AnyObject

EmptyPlugin

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

    See more

    Declaration

    Swift

    public protocol EmptyPlugin : AnyObject

EmptyViewDelegate

ImagePlugin

ImageAlbumController

ImagePickerPreviewController

ImagePickerController

ImagePickerPlugin

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

    See more

    Declaration

    Swift

    public protocol ImagePickerPlugin : AnyObject

ImagePreviewView

ImagePreviewPlugin

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

    See more

    Declaration

    Swift

    public protocol ImagePreviewPlugin : AnyObject
  • ZoomImageView事件代理

    See more

    Declaration

    Swift

    @objc
    public protocol ZoomImageViewDelegate

RefreshPlugin

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

    See more

    Declaration

    Swift

    public protocol RefreshPlugin : AnyObject

RequestPlugin

ToastPlugin

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

    See more

    Declaration

    Swift

    public protocol ToastPlugin : AnyObject

IndicatorViewAnimation

ProgressViewPlugin

IndicatorViewPlugin

ViewPlugin

AuthorizeProtocol

CacheProtocol

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

    See more

    Declaration

    Swift

    public protocol CacheProtocol

CacheEngineProtocol

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

    See more

    Declaration

    Swift

    public protocol CacheEngineProtocol

AnyEncoder

AnyDecoder

AnyDateFormatter

CodableDecodingConverter

DefaultCaseCodable

  • Undocumented

    See more

    Declaration

    Swift

    public protocol DefaultCaseCodable : Decodable, Encodable, RawRepresentable

ObjectType

AnyParameter

Subscript

PlayerCacheLoaderManager

PlayerCacheLoader

PlayerCacheDownloader

PlayerCacheRequestWorker

VideoPlayerDelegate

VideoPlayerPlaybackDelegate

AutoPurgingImageCache

BatchRequest

ChainRequest

HTTPRequest

RequestMultipartFormData

RequestError

RequestFilter

RequestAccessory

RequestRetrier

RequestValidator

RequestCache

WebSocket

WebSocketServer

Security

Compression

Engine

Transport

Framer

DynamicLayoutViewProtocol

UIViewController+Toolkit

Introspect

IntrospectableViewType

PlatformVersion

  • Undocumented

    See more

    Declaration

    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