Protocols

The following protocols are available globally.

ObjCBridge

  • ObjC桥接协议,Swift扩展实现桥接协议即可

    See more

    Declaration

    Objective-C

    @protocol FWObjCBridgeProtocol <NSObject>

    Swift

    protocol ObjCBridgeProtocol : NSObjectProtocol

AutoloadProtocol

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

    See more

    Declaration

    Swift

    public protocol AutoloadProtocol

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

  • 视图控制器挂钩协议,可覆写

    如果需要支持继承,建议基类在非extension中实现该协议的所有方法,从而忽略协议扩展的默认实现

    See more

    Declaration

    Swift

    public protocol ViewControllerProtocol

WebViewControllerProtocol

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

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

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

    Declaration

    Swift

    public protocol WebViewControllerProtocol : ViewControllerProtocol, WebViewDelegate

AnyCodableModel

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

    See more

    Declaration

    Swift

    public protocol AnyCodableModel : AnyCodableType

AnyCodableModel+CodableModel

  • 通用Codable编码模型协议,默认未实现SafeCodableModel(实现init即可)

    Declaration

    Swift

    public protocol CodableModel : AnyCodableModel, Decodable, Encodable

Export

Measuable

  • Undocumented

    Declaration

    Swift

    public protocol _Measurable

Transformable

EnumType

ExtendCustomModelType

ExtendCustomBasicType

TransformType

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

AnyCodableType

AnyParameter

AnyEncoder

AnyDecoder

AnyDateFormatter

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

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