UIApplication

@_spi(FW) extension UIApplication
  • 是否是调试模式

    Declaration

    Swift

    public static var fw_isDebug: Bool { get }

UIApplication+Toolkit

  • 读取应用名称

    Declaration

    Swift

    public static var fw_appName: String { get }
  • 读取应用显示名称,未配置时读取名称

    Declaration

    Swift

    public static var fw_appDisplayName: String { get }
  • 读取应用主版本号,可自定义,示例:1.0.0

    Declaration

    Swift

    public static var fw_appVersion: String { get set }
  • 读取应用构建版本号,示例:1.0.0.1

    Declaration

    Swift

    public static var fw_appBuildVersion: String { get }
  • 读取应用唯一标识

    Declaration

    Swift

    public static var fw_appIdentifier: String { get }
  • 读取应用可执行程序名称

    Declaration

    Swift

    public static var fw_appExecutable: String { get }
  • 读取应用信息字典

    Declaration

    Swift

    public static func fw_appInfo(_ key: String) -> Any?
  • 读取应用启动URL

    Declaration

    Swift

    public static func fw_appLaunchURL(_ options: [UIApplication.LaunchOptionsKey : Any]?) -> URL?
  • 能否打开URL(NSString|NSURL),需配置对应URL SCHEME到Info.plist才能返回YES

    Declaration

    Swift

    public static func fw_canOpenURL(_ url: URLParameter?) -> Bool
  • 打开URL,支持NSString|NSURL,完成时回调,即使未配置URL SCHEME,实际也能打开成功,只要调用时已打开过对应App

    Declaration

    Swift

    public static func fw_openURL(_ url: URLParameter?, completionHandler: ((Bool) -> Void)? = nil)
  • 打开通用链接URL,支持NSString|NSURL,完成时回调。如果是iOS10+通用链接且安装了App,打开并回调YES,否则回调NO

    Declaration

    Swift

    public static func fw_openUniversalLinks(_ url: URLParameter?, completionHandler: ((Bool) -> Void)? = nil)
  • 判断URL是否是系统链接(如AppStore|电话|设置等),支持NSString|NSURL

    Declaration

    Swift

    public static func fw_isSystemURL(_ url: URLParameter?) -> Bool
  • 判断URL是否在指定Scheme链接数组中,不区分大小写

    Declaration

    Swift

    public static func fw_isSchemeURL(_ url: URLParameter?, schemes: [String]) -> Bool
  • 判断URL是否HTTP链接,支持NSString|NSURL

    Declaration

    Swift

    public static func fw_isHttpURL(_ url: URLParameter?) -> Bool
  • 判断URL是否是AppStore链接,支持NSString|NSURL

    Declaration

    Swift

    public static func fw_isAppStoreURL(_ url: URLParameter?) -> Bool
  • 打开AppStore下载页

    Declaration

    Swift

    public static func fw_openAppStore(_ appId: String, completionHandler: ((Bool) -> Void)? = nil)
  • 打开AppStore评价页

    Declaration

    Swift

    public static func fw_openAppStoreReview(_ appId: String, completionHandler: ((Bool) -> Void)? = nil)
  • 打开应用内评价,有次数限制

    Declaration

    Swift

    public static func fw_openAppReview()
  • 打开系统应用设置页

    Declaration

    Swift

    public static func fw_openAppSettings(_ completionHandler: ((Bool) -> Void)? = nil)
  • 打开系统应用通知设置页

    Declaration

    Swift

    public static func fw_openAppNotificationSettings(_ completionHandler: ((Bool) -> Void)? = nil)
  • 打开系统邮件App

    Declaration

    Swift

    public static func fw_openMailApp(_ email: String, completionHandler: ((Bool) -> Void)? = nil)
  • 打开系统短信App

    Declaration

    Swift

    public static func fw_openMessageApp(_ phone: String, completionHandler: ((Bool) -> Void)? = nil)
  • 打开系统电话App

    Declaration

    Swift

    public static func fw_openPhoneApp(_ phone: String, completionHandler: ((Bool) -> Void)? = nil)
  • 打开系统分享

    Declaration

    Swift

    public static func fw_openActivityItems(_ activityItems: [Any], excludedTypes: [UIActivity.ActivityType]? = nil, completionHandler: UIActivityViewController.CompletionWithItemsHandler? = nil, customBlock: ((UIActivityViewController) -> Void)? = nil)
  • 打开内部浏览器,支持NSString|NSURL,点击完成时回调

    Declaration

    Swift

    public static func fw_openSafariController(_ url: URLParameter?, completionHandler: (() -> Void)? = nil, customBlock: ((SFSafariViewController) -> Void)? = nil)
  • 打开短信控制器,完成时回调

    Declaration

    Swift

    public static func fw_openMessageController(_ controller: MFMessageComposeViewController, completionHandler: ((Bool) -> Void)? = nil)
  • 打开邮件控制器,完成时回调

    Declaration

    Swift

    public static func fw_openMailController(_ controller: MFMailComposeViewController, completionHandler: ((Bool) -> Void)? = nil)
  • 打开Store控制器,完成时回调

    Declaration

    Swift

    public static func fw_openStoreController(_ parameters: [String : Any], completionHandler: ((Bool) -> Void)? = nil, customBlock: ((SKStoreProductViewController) -> Void)? = nil)
  • 打开视频播放器,支持AVPlayerItem|NSURL|NSString

    Declaration

    Swift

    public static func fw_openVideoPlayer(_ url: Any?) -> AVPlayerViewController?
  • 打开音频播放器,支持NSURL|NSString

    Declaration

    Swift

    public static func fw_openAudioPlayer(_ url: URLParameter?) -> AVAudioPlayer?
  • 播放内置声音文件

    Declaration

    Swift

    @discardableResult
    public static func fw_playSystemSound(_ file: String, completionHandler: (() -> Void)? = nil) -> SystemSoundID
  • 停止播放内置声音文件

    Declaration

    Swift

    public static func fw_stopSystemSound(_ soundId: SystemSoundID)
  • 播放内置震动

    Declaration

    Swift

    public static func fw_playSystemVibrate(_ completionHandler: (() -> Void)? = nil)
  • 播放触控反馈

    Declaration

    Swift

    public static func fw_playImpactFeedback(_ style: UIImpactFeedbackGenerator.FeedbackStyle = .medium)
  • 语音朗读文字,可指定语言(如zh-CN)

    Declaration

    Swift

    public static func fw_playSpeechUtterance(_ string: String, language: String?)
  • 是否是盗版(不是从AppStore安装)

    Declaration

    Swift

    public static var fw_isPirated: Bool { get }
  • 是否是Testflight版本

    Declaration

    Swift

    public static var fw_isTestflight: Bool { get }
  • 是否是AppStore版本

    Declaration

    Swift

    public static var fw_isAppStore: Bool { get }
  • 开始后台任务,task必须调用completionHandler

    Declaration

    Swift

    public static func fw_beginBackgroundTask(_ task: (@escaping () -> Void) -> Void, expirationHandler: (() -> Void)? = nil)