Protocols

The following protocols are available globally.

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

CodableModel

  • 通用Codable模型协议,使用方式同Codable一致

    Declaration

    Swift

    public protocol CodableModel : AnyModel, Decodable, Encodable

AnyModel

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

    See more

    Declaration

    Swift

    public protocol AnyModel : ObjectType

MappedCodableModel

  • 模型可实现MappedCodableModel键名映射协议,并选择以下模式使用,推荐方式

    模式一:MappedValue模式

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

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

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

    模式三:自定义模式

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

    ExCodable

    See more

    Declaration

    Swift

    public protocol MappedCodableModel : CodableModel

MappedValue

SmartModel

AnyArchivable

  • 任意可归档对象协议,兼容UserDefaults | Cache | Database | Keychain | Codable | CodableModel | SmartModel | MappableModel使用

    See more

    Declaration

    Swift

    public protocol AnyArchivable : ObjectType

SmartDecodable

SmartEncodable

SmartType

PropertyWrapper

Transformer

BadgeView

CollectionViewSectionConfig

DynamicLayoutViewProtocol

ReusableViewPool

ScanCode

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

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

ImageCoderPlugin

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

    See more

    Declaration

    Swift

    public protocol ImageCoderPlugin : AnyObject

AutoPurgingImageCache

ImagePlugin

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

    See more

    Declaration

    Swift

    public protocol ImagePlugin : AnyObject

ImageCropControllerProtocol

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

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

AuthorizeProtocol

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

AnyEncoder

AnyDecoder

AnyDateFormatter

CodableDecodingConverter

DefaultCaseCodable

  • Undocumented

    See more

    Declaration

    Swift

    public protocol DefaultCaseCodable : Decodable, Encodable, RawRepresentable

Subscript

AutoloadProtocol

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

    See more

    Declaration

    Swift

    public protocol AutoloadProtocol

ConfigurationTemplateProtocol

LogFormatter

  • 日志格式化处理器协议

    See more

    Declaration

    Swift

    public protocol LogFormatter

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

ViewControllerLifecycleObservable

TitleViewProtocol

CloudDrive

CacheMMKVCompatible

  • 可扩展MMKV缓存兼容类型,用于针对指定类型优化存取方式,默认采用Archiver归档存取

    See more

    Declaration

    Swift

    public protocol CacheMMKVCompatible

MappableModel

  • 通用Mappable模型,兼容AnyModel、AnyArchivable等协议

    Declaration

    Swift

    public protocol MappableModel : AnyModel, Mappable

Introspect

  • Undocumented

    See more

    Declaration

    Swift

    @MainActor
    public protocol PlatformEntity : AnyObject

IntrospectableViewType

PlatformVersion

AttributedLabel

AttributedLabelURLDetector

BannerView

BarrageCell

  • Undocumented

    Declaration

    Swift

    public protocol BarrageCellDelegate : CAAnimationDelegate

CollectionViewWaterfallLayout

CollectionViewAlignLayout

DrawerView

  • 抽屉拖拽视图事件代理

    See more

    Declaration

    Swift

    @MainActor
    public protocol DrawerViewDelegate : AnyObject

PageControl

  • 分页控件事件代理

    See more

    Declaration

    Swift

    @MainActor
    public protocol PageControlDelegate : NSObjectProtocol

DotView

PagingListContainerView

PagingMainTableView

PagingView

PagingSmoothView

SkeletonAnimation

SkeletonView

StatisticalViewProtocol

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

AlertController

ImageAlbumController

ImagePickerPreviewController

ImagePickerController

ImagePickerTitleView

IndicatorViewAnimation

PlayerCacheLoaderManager

PlayerCacheLoader

PlayerCacheDownloader

PlayerCacheRequestWorker

VideoPlayerDelegate

VideoPlayerPlaybackDelegate

WebSocket

WebSocketServer

Security

Compression

Engine

Transport

Framer

functions for simpler array buffer reading and writing

AnyChainable

UIView+ResultBuilder