Classes

The following classes are available globally.

WrapperGlobal

  • 全局包装器(因struct只读,只能用class)

    See more

    Declaration

    Swift

    public class WrapperGlobal

Autoloader

  • 自动加载器,处理swift不支持load方法问题

    本方案采用objc扩展方法实现,相对于全局扫描类方案性能高,使用简单,使用方法: 新增Autoloader objc扩展,以load开头且无参静态方法即会自动调用,方法名建议[load模块名_文件名|类名]

    See more

    Declaration

    Swift

    public class Autoloader : NSObject, AutoloadProtocol

Benchmark

  • 时间调试器

    See more

    Declaration

    Swift

    public class Benchmark : NSObject

Wrapper

  • 属性包装器(因struct只读,只能用class)

    See more

    Declaration

    Swift

    public class Wrapper<Base>

Promise

Configuration

  • 配置基类,使用时继承即可

    默认自动查找模板类名格式优先级如下:

    1. 当前模块.[配置类]+Template
    2. 主项目.[配置类]+Template
    3. 当前模块.[配置类]+DefaultTemplate
    See more

    Declaration

    Swift

    open class Configuration : NSObject

ConfigurationTemplate

ErrorManager

  • 错误异常捕获类

    JJException AvoidCrash

    See more

    Declaration

    Swift

    public class ErrorManager : NSObject
  • 通用加载器,添加处理句柄后指定输入即可加载输出结果

    See more

    Declaration

    Swift

    public class Loader<Input, Output> : NSObject

Logger

  • 日志记录类。支持设置全局日志级别和自定义LoggerPlugin插件

    See more

    Declaration

    Swift

    public class Logger : NSObject

LoggerPlugin

LoggerPluginImpl

Mediator

  • iOS模块化架构中间件,结合Router可搭建模块化架构设计

    支持两种模块加载模式: 模式一:Delegate模式,推荐使用,详见方法:checkAllModules(_:) 模式二:Runtime模式,详见方法:checkAllModules(selector:arguments:)

    Bifrost

    See more

    Declaration

    Swift

    public class Mediator : NSObject

ModuleBundle

  • 业务模块Bundle基类,各模块可继承

    资源查找规则如下:

    1. ModuleBundle基类或主应用模块类只加载主Bundle
    2. ModuleBundle子模块类优先加载主应用的{模块名称}.bundle(可替换模块),如主应用内FWFramework.bundle
    3. ModuleBundle子模块类其次加载该模块的{模块名称}.bundle,如框架内FWFramework.bundle
    4. ModuleBundle子模块类以上都不存在时返回nil加载主Bundle
    See more

    Declaration

    Swift

    open class ModuleBundle : NSObject

Navigator

  • 导航管理器

    See more

    Declaration

    Swift

    public class Navigator : NSObject

PluginManager

  • 插件管理器类。支持插件冷替换(使用插件前)和热替换(先释放插件)

    和Mediator对比如下: Plugin:和业务无关,侧重于工具类、基础设施、可替换,比如Toast、Loading等 Mediator: 和业务相关,侧重于架构、业务功能、模块化,比如用户模块,订单模块等

    See more

    Declaration

    Swift

    public class PluginManager : NSObject

WeakProxy

  • 弱引用代理类,用于解决NSTimer等循环引用target问题(默认NSTimer会强引用target,直到invalidate)

    See more

    Declaration

    Swift

    public class WeakProxy : NSObject

DelegateProxy

  • 事件协议代理基类,可继承重写事件代理方法

    See more

    Declaration

    Swift

    open class DelegateProxy<T> : NSObject

WeakObject

  • 弱引用对象容器类,用于解决关联对象weak引用等

    See more

    Declaration

    Swift

    public class WeakObject : NSObject

MulticastDelegate

Router

  • URL路由器

    由于Function也是闭包,Handler参数支持静态方法,示例:AppRouter.routePlugin(_:) MGJRouter FFRouter

    See more

    Declaration

    Swift

    public class Router : NSObject

StateObject

StateEvent

  • 状态事件类

    See more

    Declaration

    Swift

    public class StateEvent : NSObject

StateTransition

StateMachine

SwizzleStore

  • 方法交换存储器

    MethodSignature示例:(@convention© (NSObject, Selector) -> Void).self SwizzleSignature示例:(@convention(block) (NSObject) -> Void).self

    See more

    Declaration

    Swift

    public class SwizzleStore<MethodSignature, SwizzleSignature>
  • 任务操作类,可继承或直接使用

    See more

    Declaration

    Swift

    open class TaskOperation : Operation
  • 任务管理器,兼容NSBlockOperation和NSInvocationOperation

    See more

    Declaration

    Swift

    open class TaskManager : NSObject

TestCase

  • 单元测试用例基类,所有单元测试用例必须继承。注意测试方法需标记objc,让OC可以访问

    调试模式下自动执行,按模块单元测试命名格式:TestCase_module_name

    See more

    Declaration

    Swift

    open class TestCase : NSObject
  • 框架内置应用Bundle类,应用可替换

    如果主应用存在FWFramework.bundle或主Bundle内包含对应图片|多语言,则优先使用;否则使用框架默认实现。 FWFramework所需本地化翻译如下:完成|关闭|确定|取消|原有,配置同App本地化一致即可,如zh-Hans|en等

    See more

    Declaration

    Swift

    open class AppBundle : ModuleBundle
  • AppDelegate基类

    See more

    Declaration

    Swift

    open class AppResponder : UIResponder, UIApplicationDelegate
  • SceneDelegate基类

    See more

    Declaration

    Swift

    open class SceneResponder : UIResponder, UIWindowSceneDelegate

NavigationStyle

TabBarController

TabBar

  • FWTabBar是高度自定义的UITabBar子类,通过添加UIControl的方式实现自定义tabBarItem的效果。目前支持tabBar的大部分属性的设置,例如delegate,items,selectedImge,itemPositioning,itemWidth,itemSpacing等,以后会更加细致的优化tabBar原有属性的设置效果。

    See more

    Declaration

    Swift

    open class TabBar : UITabBar

TabBarItem

  • FWTabBarItem inherits from UITabBarItem, the purpose is to provide UITabBarItem property settings for FWTabBarItemContentView. Support most commonly used attributes, such as image, selectedImage, title, tag etc.

    Unsupport properties: MARK: UIBarItem properties 1. var landscapeImagePhone: UIImage? 2. var imageInsets: UIEdgeInsets 3. var landscapeImagePhoneInsets: UIEdgeInsets 4. func setTitleTextAttributes(_ attributes: [String : Any]?, for state: UIControlState) 5. func titleTextAttributes(for state: UIControlState) -> [String : Any]? MARK: UITabBarItem properties 1. func setBadgeTextAttributes(_ textAttributes: [String : Any]?, for state: UIControlState) 2. func badgeTextAttributes(for state: UIControlState) -> [String : Any]?

    See more

    Declaration

    Swift

    open class TabBarItem : UITabBarItem

TabBarItemContentView

TabBarItemMoreContentView

TabBarItemBadgeView

  • FWTabBarItemBadgeView 这个类定义了item中使用的badge视图样式,默认为FWTabBarItemBadgeView类对象。 你可以设置FWTabBarItemContentView的badgeView属性为自定义的FWTabBarItemBadgeView子类,这样就可以轻松实现 自定义通知样式了。

    See more

    Declaration

    Swift

    open class TabBarItemBadgeView : UIView

ViewControllerIntercepter

ViewControllerManager

  • 视图控制器管理器

    框架默认未注册ViewControllerProtocol协议拦截器,如需全局配置控制器,使用全局自定义block即可

    See more

    Declaration

    Swift

    public class ViewControllerManager : NSObject

AnimatedTransition

  • 转场动画类,默认透明度变化

    See more

    Declaration

    Swift

    open class AnimatedTransition: UIPercentDrivenInteractiveTransition,
                                   UIViewControllerAnimatedTransitioning,
                                   UIViewControllerTransitioningDelegate,
                                   UINavigationControllerDelegate

SwipeAnimatedTransition

TransformAnimatedTransition

PresentationController

  • 自定义展示控制器。默认显示暗色背景动画且弹出视图占满容器,可通过属性自定义

    See more

    Declaration

    Swift

    open class PresentationController : UIPresentationController

PanGestureRecognizer

  • 自动处理与滚动视图pan手势在指定方向的冲突,默认设置delegate为自身。如果找到滚动视图则处理之,否则同父类

    See more

    Declaration

    Swift

    open class PanGestureRecognizer : UIPanGestureRecognizer, UIGestureRecognizerDelegate

MappedValue

Deserializer

HelpingMapper

TransformOf

URLTransform

EnumTransform

NSDecimalNumberTransform

DataTransform

HexColorTransform

DateTransform

DateFormatterTransform

ISO8601DateTransform

CustomDateFormatTransform

ValidatedValue

  • ValidatedValue属性包装器注解,默认为手工指定或初始值

    使用示例: @ValidatedValue(.isEmail) var email: String = “”

    See more

    Declaration

    Swift

    @propertyWrapper
    public class ValidatedValue<Value>
    extension ValidatedValue: JSONMappedValue

AttributedLabel

AttributedLabelURL

AttributedLabelURLDetector

AttributedLabelAttachment

BadgeView

  • 提醒灯视图,默认禁用userInteractionEnabled,使用非等比例缩放布局

    See more

    Declaration

    Swift

    open class BadgeView : UIView, BadgeViewProtocol

BannerView

BannerViewFlowLayout

BannerViewCell

  • Banner视图默认Cell

    See more

    Declaration

    Swift

    open class BannerViewCell : UICollectionViewCell

BarrageManager

BarrageRenderView

BarrageDescriptor

BarrageCell

BarrageTextDescriptor

BarrageTextCell

BarrageTrackInfo

CollectionViewDelegate

  • 常用集合视图数据源和事件代理,可继承

    See more

    Declaration

    Swift

    open class CollectionViewDelegate : DelegateProxy<UICollectionViewDelegate>, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout

CollectionViewSectionConfig

CollectionViewFlowLayout

  • 集合视图流式布局,支持纵向渲染和分页滚动效果

    系统FlowLayout水平滚动时默认横向渲染,可通过本类开启纵向渲染,示例效果如下: [0 3 6 9 ] [0 1 2 3 ] [1 4 7 10] => [4 5 6 7 ] [2 5 8 11] [8 9 10 11]

    CenteredCollectionView

    See more

    Declaration

    Swift

    open class CollectionViewFlowLayout : UICollectionViewFlowLayout

CollectionViewAlignLayout

  • 在 UICollectionViewFlowLayout 基础上,自定义 UICollectionView 对齐布局 注意:滚动方向默认为垂直滚动,不可设置滚动方向

    实现以下功能:

    1. 设置水平方向对齐方式:流式(默认)、流式填充、居左、居中、居右、平铺;
    2. 设置竖直方向对齐方式:居中(默认)、置顶、置底;
    3. 设置显示条目排布方向:从左到右(默认)、从右到左。 JQCollectionViewAlignLayout
    See more

    Declaration

    Swift

    open class CollectionViewAlignLayout : UICollectionViewFlowLayout

CollectionViewWaterfallLayout

DrawerView

  • 抽屉拖拽视图

    See more

    Declaration

    Swift

    open class DrawerView : NSObject, UIGestureRecognizerDelegate, UIScrollViewDelegate
  • 浮动布局视图

    做类似 CSS 里的 float:left 的布局,自行使用 addSubview: 将子 View 添加进来即可。 支持通过 contentMode 属性修改子 View 的对齐方式,目前仅支持 UIViewContentModeLeftUIViewContentModeRight,默认为 UIViewContentModeLeft

    QMUI_iOS

    See more

    Declaration

    Swift

    open class FloatLayoutView : UIView
  • 渐变View,无需设置渐变Layer的frame等,支持自动布局

    See more

    Declaration

    Swift

    open class GradientView : UIView
  • 半圆圆角View,无需frame快捷设置半圆圆角、边框等

    See more

    Declaration

    Swift

    open class RoundedCornerView : UIView
  • 网格视图

    用于做九宫格布局,会将内部所有的 subview 根据指定的列数和行高,把每个 item(也即 subview) 拉伸到相同的大小。 支持在 item 和 item 之间显示分隔线,分隔线支持虚线。 注意分隔线是占位的,把 item 隔开,而不是盖在某个 item 上。

    QMUI_iOS

    See more

    Declaration

    Swift

    open class GridView : UIView
  • 简易的跑马灯 label 控件,在文字超过 label 可视区域时会自动开启跑马灯效果展示文字,文字滚动时是首尾连接的效果(参考播放音乐时系统锁屏界面顶部的音乐标题)。

    lineBreakMode 默认为 NSLineBreakByClipping(UILabel 默认值为 NSLineBreakByTruncatingTail)。 textAlignment 暂不支持 NSTextAlignmentJustified 和 NSTextAlignmentNatural。 会忽略 numberOfLines 属性,强制以 1 来展示。

    QMUI_iOS

    See more

    Declaration

    Swift

    open class MarqueeLabel : UILabel

PageControl

DotView

PagingListContainerView

  • Undocumented

    See more

    Declaration

    Swift

    open class PagingListContainerView : UIView
    extension PagingListContainerView: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout

PagingMainTableView

  • Undocumented

    See more

    Declaration

    Swift

    open class PagingMainTableView : UITableView, UIGestureRecognizerDelegate

PagingView

PagingListRefreshView

PagingSmoothView

  • Undocumented

    See more

    Declaration

    Swift

    open class PagingSmoothView : UIView
    extension PagingSmoothView: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout
  • Undocumented

    See more

    Declaration

    Swift

    public class PagingSmoothCollectionView : UICollectionView, UIGestureRecognizerDelegate

PasscodeView

  • PasscodeView

    CRBoxInputView

    See more

    Declaration

    Swift

    open class PasscodeView : UIView, UICollectionViewDataSource, UICollectionViewDelegate, UITextFieldDelegate

PasscodeCellProperty

PasscodeCell

  • Undocumented

    See more

    Declaration

    Swift

    open class PasscodeCell : UICollectionViewCell

PasscodeLineView

PasscodeSecrectImageView

PasscodeFlowLayout

ReusableViewPool

  • 通用可重用视图缓存池,可继承

    使用方式如下,代码示例详见WebView:

    1. 应用启动完成时配置全局重用初始化句柄并调用enqueueReusableView(with: ReusableViewType.self)预加载第一个视图
    2. 重用视图初始化时调用:let reusableView = ReusableViewPool.shared.dequeueReusableView(with: ReusableViewType.self, viewHolder: self)
    3. 在需要预加载的场景中调用:reusableView.fw_preloadReusableView() 预加载下一个视图
    4. 在需要回收到缓存池时(一般控制器deinit)调用:ReusableViewPool.shared.enqueueReusableView(reusableView)
    See more

    Declaration

    Swift

    open class ReusableViewPool : NSObject

ScanCode

  • 二维码、条形码扫描,默认仅开启二维码

    不建议同时开启二维码和条形码,因为开启后条形码很难识别且只有中心位置可识别。 默认二维码类型示例:[.qr] 默认条形码类型示例:[.code39, .code39Mod43, .code93, .code128, .ean8, .ean13, .upce, .interleaved2of5]

    SGQRCode

    See more

    Declaration

    Swift

    open class ScanCode : NSObject, AVCaptureMetadataOutputObjectsDelegate, AVCaptureVideoDataOutputSampleBufferDelegate

ScanView

SkeletonAnimation

SkeletonAppearance

SkeletonView

  • 骨架屏视图,支持设置占位图片

    See more

    Declaration

    Swift

    open class SkeletonView : UIView

SkeletonLabel

SkeletonLayout

  • 骨架屏布局视图,可从视图生成骨架屏,嵌套到UIScrollView即可实现滚动

    See more

    Declaration

    Swift

    open class SkeletonLayout : SkeletonView

SkeletonTableView

SkeletonCollectionView

  • 骨架屏集合视图,可生成集合骨架屏

    See more

    Declaration

    Swift

    open class SkeletonCollectionView : SkeletonLayout, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout

StatisticalManager

  • 事件统计管理器

    视图从不可见变为可见时曝光开始,触发曝光开始事件(triggerDuration为0); 视图从可见到不可见时曝光结束,视为一次曝光,触发曝光结束事件(triggerDuration大于0)并统计曝光时长。 默认未开启曝光时长统计,仅触发开始事件用于统计次数;开启曝光时长统计后会触发结束事件并统计时长,应用退后台时不计曝光时间。 默认运行模式时,视图快速滚动不计算曝光,可配置runLoopMode快速滚动时也计算曝光

    See more

    Declaration

    Swift

    public class StatisticalManager : NSObject

StatisticalEvent

TableViewDelegate

ToolbarView

  • 自定义工具栏视图,使用非等比例缩放布局,高度自动布局(总高度toolbarHeight),可设置toolbarHidden隐藏(总高度0)

    根据toolbarPosition自动设置默认高度,可自定义,如下: 顶部:topView,高度为topHeight,可设置topHidden隐藏 中间:menuView,高度为menuHeight,可设置menuHidden隐藏 底部:bottomView,高度为bottomHeight,可设置bottomHidden隐藏

    See more

    Declaration

    Swift

    open class ToolbarView : UIView

ToolbarMenuView

  • 自定义工具栏菜单视图,使用非等比例缩放布局,支持完全自定义,默认最多只支持左右各两个按钮,如需更多按钮,请自行添加。

    水平分割时,按钮水平等分;非水平分割时,左右侧间距为8,同系统一致

    See more

    Declaration

    Swift

    open class ToolbarMenuView : UIView

ToolbarTitleView

  • 可作为导航栏标题控件,使用非等比例缩放布局,通过 navigationItem.titleView 来设置。也可当成单独的标题组件,脱离 UIViewController 使用

    默认情况下 titleView 是不支持点击的,如需点击,请把 userInteractionEnabled 设为 YES QMUI_iOS

    See more

    Declaration

    Swift

    open class ToolbarTitleView : UIControl, TitleViewProtocol

ToolbarButton

  • 自定义工具栏按钮,使用非等比例缩放布局,兼容系统customView方式和自定义方式

    UIBarButtonItem自定义导航栏时最左和最右间距为16,系统导航栏时为8; ToolbarButton作为customView使用时,会自动调整按钮内间距,和系统表现一致; ToolbarButton自动适配横竖屏切换,竖屏时默认内间距{8, 8, 8, 8},横屏时默认内间距{0,8,0,8}

    See more

    Declaration

    Swift

    open class ToolbarButton : UIButton

ExpandedTitleView

  • 扩展titleView,可继承,用于navigationItem.titleView需要撑开的场景

    组件自动兼容各版本系统titleView左右间距(默认16),具体差异如下: iOS16+:系统titleView左右最小间距为16,组件默认处理为16 iOS15-:系统titleView左右最小间距为8,组件默认处理为16 注意:扩展区域不可点击,如需点击,可使用isPenetrable实现

    See more

    Declaration

    Swift

    open class ExpandedTitleView : UIView

ScrollViewDelegate

TextFieldDelegate

TextViewDelegate

SearchBarDelegate

WebView

  • WKWebView封装,默认实现进度条、JS弹窗、Cookie管理、自定义User-Agent等

    备注:

    1. 如需实现加载离线资源等场景,请使用configuration.setURLSchemeHandler
    2. 第一次加载可携带自定义Header,如果存在重定向,Header里面的Authorization因安全策略会丢失。解决方法示例:可新增Header比如X-Authorization,重定向时不会丢失
    3. 后续非首次加载自定义Header会丢失,解决方法示例:通过JSBridge桥接获取授权信息或采用GET参数|cookie储存等
    4. 如果遇到Cookie丢失问题,可尝试开启cookieEnabled或自行设置Cookie等
    See more

    Declaration

    Swift

    open class WebView : WKWebView

WebViewCookieManager

WebViewJSBridge

  • WKWebView实现Javascript桥接器

    参考链接: WKWebViewJavascriptBridge

    Javascript示例: (兼容FWFramework/[WK]WebViewJavascriptBridge)

    function setupWebViewJavascriptBridge(callback) {
        if (window.webkit &&
            window.webkit.messageHandlers &&
            window.webkit.messageHandlers.iOS_Native_InjectJavascript) {
            if (window.WKWebViewJavascriptBridge) { return callback(WKWebViewJavascriptBridge); }
            if (window.WKWVJBCallbacks) { return window.WKWVJBCallbacks.push(callback); }
            window.WKWVJBCallbacks = [callback];
            window.webkit.messageHandlers.iOS_Native_InjectJavascript.postMessage(null);
            return;
        }
    
        if (window.WebViewJavascriptBridge) { return callback(WebViewJavascriptBridge); }
        if (window.WVJBCallbacks) { return window.WVJBCallbacks.push(callback); }
        window.WVJBCallbacks = [callback];
        var WVJBIframe = document.createElement('iframe');
        WVJBIframe.style.display = 'none';
        WVJBIframe.src = 'https://__bridge_loaded__';
        document.documentElement.appendChild(WVJBIframe);
        setTimeout(function() { document.documentElement.removeChild(WVJBIframe) }, 0)
    }
    
    setupWebViewJavascriptBridge(function(bridge) {
        bridge.registerHandler('jsHandler', function(data, responseCallback) {
            var responseData = {'key': 'value'}
            responseCallback(responseData)
        })
    
        bridge.callHandler('iosHandler', {'key': 'value'}, function(response) {
            console.log(response)
        })
    })
    
    See more

    Declaration

    Swift

    public class WebViewJSBridge : NSObject, WKScriptMessageHandler

AlertController

AlertAction

AlertAppearance

  • 系统弹出框样式配置类,由于系统兼容性,建议优先使用AlertController

    备注:如果未自定义样式,显示效果和系统一致,不会产生任何影响;框架会先渲染actions动作再渲染cancel动作

    See more

    Declaration

    Swift

    public class AlertAppearance : NSObject

AlertPluginImpl

AlertControllerImpl

PlaceholderView

  • 通用的空界面控件,布局顺序从上到下依次为:imageView, loadingView, textLabel, detailTextLabel, actionButton

    QMUI_iOS

    See more

    Declaration

    Swift

    open class PlaceholderView : UIView

ScrollOverlayView

ImageAlbumController

  • 当前设备照片里的相簿列表

    使用方式:

    1. 使用 init 初始化。
    2. 指定一个 albumControllerDelegate,并实现 @required 方法。

    注意,iOS 访问相册需要得到授权,建议先询问用户授权([AssetsManager requestAuthorization:]),通过了再进行 ImageAlbumController 的初始化工作。

    See more

    Declaration

    Swift

    open class ImageAlbumController : UIViewController, UITableViewDataSource, UITableViewDelegate
  • 相册列表默认Cell

    See more

    Declaration

    Swift

    open class ImageAlbumTableCell : UITableViewCell

ImagePickerPreviewController

ImagePickerController

ImagePickerPluginImpl

ImagePickerControllerImpl

ImagePreviewView

  • 查看图片的控件,支持横向滚动、放大缩小、loading 及错误语展示,内部使用 UICollectionView 实现横向滚动及 cell 复用,因此与其他普通的 UICollectionView 一样,也可使用 reloadData、collectionViewLayout 等常用方法。

    使用方式:

    1. 使用 initWithFrame: 或 init 方法初始化。
    2. 设置 delegate。
    3. 在 delegate 的 numberOfImagesInImagePreviewView: 方法里返回图片总数。
    4. 在 delegate 的 imagePreviewView:renderZoomImageView:atIndex: 方法里为 zoomImageView.image 设置图片,如果需要,也可调用 [zoomImageView showLoading] 等方法来显示 loading。
    5. 由于 ImagePreviewViewDelegate 继承自 ZoomImageViewDelegate,所以若需要响应单击、双击、长按事件,请实现 ZoomImageViewDelegate 里的对应方法。
    6. 若需要从指定的某一张图片开始查看,可使用 currentImageIndex 属性。

    QMUI_iOS

    See more

    Declaration

    Swift

    open class ImagePreviewView : UIView, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, ZoomImageViewDelegate

ImagePreviewController

  • 图片预览控件,主要功能由内部自带的 ImagePreviewView 提供,由于以 viewController 的形式存在,所以适用于那种在单独界面里展示图片,或者需要从某张目标图片的位置以动画的形式放大进入预览界面的场景。

    使用方式:

    1. 使用 init 方法初始化
    2. 添加 self.imagePreviewView 的 delegate
    3. 以 push 或 present 的方式打开界面。如果是 present,则支持 ImagePreviewTransitioningStyle 里定义的动画。特别地,如果使用 zoom 方式,则需要通过 sourceImageView() 返回一个原界面上的 view 以作为 present 动画的起点和 dismiss 动画的终点。
    See more

    Declaration

    Swift

    open class ImagePreviewController : UIViewController, UIViewControllerTransitioningDelegate

ImagePreviewTransitionAnimator

  • 负责处理 ImagePreviewController 被 present/dismiss 时的动画,如果需要自定义动画效果,可按需修改 animationEnteringBlock、animationBlock、animationCompletionBlock。

    See more

    Declaration

    Swift

    open class ImagePreviewTransitionAnimator : NSObject, UIViewControllerAnimatedTransitioning

CollectionViewPagingLayout

  • 支持按页横向滚动的 UICollectionViewLayout,可切换不同类型的滚动动画。

    item 的大小和布局仅支持通过 UICollectionViewFlowLayout 的 property 系列属性修改,也即每个 item 都应相等。对于通过 delegate 方式返回各不相同的 itemSize、sectionInset 的场景是不支持的。

    See more

    Declaration

    Swift

    open class CollectionViewPagingLayout : UICollectionViewFlowLayout
  • 默认图片预览插件

    See more

    Declaration

    Swift

    open class ImagePreviewPluginImpl : NSObject, ImagePreviewPlugin
  • 支持缩放查看静态图片、live photo、视频的控件

    默认显示完整图片或视频,可双击查看放大后的大小,再次双击恢复到初始大小。 支持通过修改 contentMode 来控制静态图片和 live photo 默认的显示模式,目前仅支持 UIViewContentModeCenter、UIViewContentModeScaleAspectFill、UIViewContentModeScaleAspectFit、UIViewContentModeScaleToFill(仅宽度拉伸),默认为 UIViewContentModeScaleAspectFit。注意这里的显示模式是基于 viewportRect 而言的而非整个 zoomImageView。 ZoomImageView 提供最基础的图片预览和缩放功能,其他功能请通过继承来实现。

    QMUI_iOS

    See more

    Declaration

    Swift

    open class ZoomImageView : UIView, UIScrollViewDelegate, UIGestureRecognizerDelegate
  • ZoomImageView视频工具栏

    See more

    Declaration

    Swift

    open class ZoomImageVideoToolbar : UIView
  • ZoomImageView视频播放器视图

    See more

    Declaration

    Swift

    open class ZoomImageVideoPlayerView : UIView
  • 默认刷新插件

    See more

    Declaration

    Swift

    open class RefreshPluginImpl : NSObject, RefreshPlugin

PullRefreshView

  • 下拉刷新视图,默认高度60。如果indicatorView为自定义指示器时会自动隐藏标题和箭头,仅显示指示器视图

    SVPullToRefresh

    See more

    Declaration

    Swift

    open class PullRefreshView : UIView

InfiniteScrollView

RequestPluginImpl

IndicatorView

AuthorizeManager

  • 权限管理器。由于打包上传ipa时会自动检查隐私库并提供Info.plist描述,所以默认关闭隐私库声明

    开启指定权限方法: Pod项目:添加pod时同时指定 pod ‘FWFramework’, :subspecs => [‘Contacts’]

    See more

    Declaration

    Swift

    public class AuthorizeManager : NSObject

KeychainManager

LocationManager

  • 位置服务

    注意:Info.plist需要添加NSLocationWhenInUseUsageDescription项。 如果请求Always定位,还需添加NSLocationAlwaysUsageDescription项和NSLocationAlwaysAndWhenInUseUsageDescription项。 iOS11可通过showsBackgroundLocationIndicator配置是否显示后台定位指示器

    See more

    Declaration

    Swift

    open class LocationManager : NSObject, CLLocationManagerDelegate

NotificationManager

  • 通知管理器

    See more

    Declaration

    Swift

    public class NotificationManager : NSObject, UNUserNotificationCenterDelegate

ThemeManager

  • 可扩展主题样式(采用class实现是为了NSObject子类可重写)

    See more

    Declaration

    Swift

    public class ThemeStyle : NSObject, RawRepresentable
  • 主题管理器,iOS13+可跟随系统改变

    框架默认只拦截了UIView|UIViewController|UIScreen|UIImageView|UILabel类,满足条件会自动触发themeChanged;如果不满足条件或者拦截未生效,需先设置主题上下文fw.themeContext才能生效。 注意事项:iOS13以下默认不支持主题切换;如需支持,请使用fw.color相关方法

    See more

    Declaration

    Swift

    public class ThemeManager : NSObject
  • 主题动态对象,可获取当前主题静态对象

    See more

    Declaration

    Swift

    public class ThemeObject<T> : NSObject

VersionManager

CacheEngine

ImageFrame

ImageCoder

Asset

  • 相册里某一个资源的包装对象,该资源可能是图片、视频等

    Asset 重写了 isEqual: 方法,只要两个 Asset 的 identifier 相同,则认为是同一个对象,以方便在数组、字典等容器中对大量 Asset 进行遍历查找等操作

    See more

    Declaration

    Swift

    public class Asset : NSObject

AssetGroup

AssetManager

  • 构建 AssetManager 这个对象并提供单例的调用方式主要出于下面两点考虑:

    1. 保存照片/视频的方法较为复杂,为了方便封装系统接口,同时灵活地扩展功能,需要有一个独立对象去管理这些方法。
      1. 使用 PhotoKit 获取图片,基本都需要一个 PHCachingImageManager 的实例,为了减少消耗,AssetManager 单例内部也构建了一个 PHCachingImageManager,并且暴露给外面,方便获取PHCachingImageManager 的实例。

    QMUI_iOS

    See more

    Declaration

    Swift

    public class AssetManager : NSObject

AssetLivePhoto

AssetSessionExporterError

PlayerCacheLoaderManager

PlayerCacheLoader

PlayerCacheDownloader

PlayerCacheRequestWorker

PlayerCacheContentInfo

PlayerCacheAction

PlayerCacheConfiguration

PlayerCacheManager

PlayerCacheSessionManager

PlayerCacheWorker

VideoPlayer

VideoPlayerView

ImageDownloader

AutoPurgingImageCache

URLSessionManager

  • URLSession管理器

    AFNetworking

    See more

    Declaration

    Swift

    open class URLSessionManager : NSObject, URLSessionDelegate, URLSessionTaskDelegate, URLSessionDataDelegate, URLSessionDownloadDelegate

BatchRequest

BatchRequestManager

ChainRequest

ChainRequestManager

HTTPRequest

  • HTTP请求基类,支持缓存和重试机制,使用时继承即可

    注意事项: 如果vc请求回调句柄中未使用weak self,会产生强引用,则self会在vc关闭且等待请求完成后才会释放 如果vc请求回调句柄中使用了weak self,不会产生强引用,则self会在vc关闭时立即释放,不会等待请求完成

    YTKNetwork

    See more

    Declaration

    Swift

    open class HTTPRequest : HTTPRequestProtocol, Equatable, CustomStringConvertible

RequestConfig

RequestAccessory

RequestRetrier

RequestValidator

RequestCache

RequestCacheMetadata

WebSocket

WebSocketServer

Security

Compression

Engine

Framer

Appearance

  • UIAppearance扩展类,支持任意NSObject对象使用UIAppearance能力

    系统默认时机是在didMoveToWindow处理UIAppearance 注意:Swift只有标记\@objc dynamic的属性才支持UIAppearance QMUI_iOS

    See more

    Declaration

    Swift

    public class Appearance : NSObject

LayoutChain

  • 视图链式布局类。如果约束条件完全相同,会自动更新约束而不是重新添加。 另外,默认布局方式使用LTR,如果需要RTL布局,可通过autoLayoutRTL统一启用

    See more

    Declaration

    Swift

    public class LayoutChain

MulticastBlock

  • 多句柄代理,线程安全,可实现重复、单次或延迟调用功能

    串行安全:读sync,写async 并行安全:读sync,写async, 用flags:.barrier加共享互斥锁

    See more

    Declaration

    Swift

    public class MulticastBlock : NSObject

TapGestureRecognizer

HostingController

  • SwiftUI控制器包装类,可将View事件用delegate代理到VC

    Controller在MVVM中也为View的角色,可持有ViewModel,负责生命周期和界面跳转

    See more

    Declaration

    Swift

    open class HostingController : UIHostingController<AnyView>

HostingView

  • SwiftUI视图包装类

    SwiftUIX

    See more

    Declaration

    Swift

    open class HostingView<Content> : UIView where Content : View
  • 视图上下文

    See more

    Declaration

    Swift

    public class ViewContext : ObservableObject

ViewPreferenceKey

  • 通用视图配置Key类

    See more

    Declaration

    Swift

    open class ViewPreferenceKey<T> : PreferenceKey where T : Equatable

ResizableView

  • 可调整大小的视图包装器,解决frame尺寸变为图片尺寸等问题

    See more

    Declaration

    Swift

    public class ResizableView<Content> : UIView where Content : UIView

AlamofireImpl

SDWebImageImpl

SDWebImagePluginIndicator

SDWebImageProgressPluginIndicator