SwifterSwift

public struct SwifterSwift

SwifterSwift: Common usefull properties and methods.

  • SwifterSwift: App’s name (if applicable).

    Declaration

    Swift

    public static var appDisplayName: String?
  • SwifterSwift: App’s bundle ID (if applicable).

    Declaration

    Swift

    public static var appBundleID: String?
  • SwifterSwift: StatusBar height

    Declaration

    Swift

    public static var statusBarHeight: CGFloat
  • SwifterSwift: App current build number (if applicable).

    Declaration

    Swift

    public static var appBuild: String?
  • SwifterSwift: Application icon badge current number.

    Declaration

    Swift

    public static var applicationIconBadgeNumber: Int
  • SwifterSwift: App’s current version (if applicable).

    Declaration

    Swift

    public static var appVersion: String?
  • SwifterSwift: Current battery level.

    Declaration

    Swift

    public static var batteryLevel: Float
  • SwifterSwift: Shared instance of current device.

    Declaration

    Swift

    public static var currentDevice: UIDevice
  • SwifterSwift: Shared instance of current device.

  • SwifterSwift: Screen height.

    Declaration

    Swift

    public static var screenHeight: CGFloat
  • SwifterSwift: Current device model.

    Declaration

    Swift

    public static var deviceModel: String
  • SwifterSwift: Current device name.

    Declaration

    Swift

    public static var deviceName: String
  • SwifterSwift: Current orientation of device.

    Declaration

    Swift

    public static var deviceOrientation: UIDeviceOrientation
  • SwifterSwift: Screen width.

    Declaration

    Swift

    public static var screenWidth: CGFloat
  • SwifterSwift: Check if app is running in debug mode.

    Declaration

    Swift

    public static var isInDebuggingMode: Bool
  • SwifterSwift: Check if app is running in TestFlight mode.

    Declaration

    Swift

    public static var isInTestFlight: Bool
  • SwifterSwift: Check if multitasking is supported in current device.

    Declaration

    Swift

    public static var isMultitaskingSupported: Bool
  • SwifterSwift: Current status bar network activity indicator state.

    Declaration

    Swift

    public static var isNetworkActivityIndicatorVisible: Bool
  • SwifterSwift: Check if device is iPad.

    Declaration

    Swift

    public static var isPad: Bool
  • SwifterSwift: Check if device is iPhone.

    Declaration

    Swift

    public static var isPhone: Bool
  • SwifterSwift: Check if device is registered for remote notifications for current app (read-only).

    Declaration

    Swift

    public static var isRegisteredForRemoteNotifications: Bool
  • SwifterSwift: Check if application is running on simulator (read-only).

    Declaration

    Swift

    public static var isRunningOnSimulator: Bool
  • SwifterSwift: Status bar visibility state.

    Declaration

    Swift

    public static var isStatusBarHidden: Bool
  • SwifterSwift: Key window (read only, if applicable).

    Declaration

    Swift

    public static var keyWindow: UIView?
  • SwifterSwift: Most top view controller (if applicable).

    Declaration

    Swift

    public static var mostTopViewController: UIViewController?
  • SwifterSwift: Shared instance UIApplication.

    Declaration

    Swift

    public static var sharedApplication: UIApplication
  • SwifterSwift: Current status bar style (if applicable).

    Declaration

    Swift

    public static var statusBarStyle: UIStatusBarStyle?
  • SwifterSwift: System current version (read-only).

    Declaration

    Swift

    public static var systemVersion: String
  • SwifterSwift: Delay function or closure call.

    Declaration

    Swift

    @discardableResult public static func delay(milliseconds: Double, queue: DispatchQueue = .main, completion: @escaping () -> Void) -> DispatchWorkItem

    Parameters

    milliseconds

    execute closure after the given delay.

    queue

    a queue that completion closure should be executed on (default is DispatchQueue.main).

    completion

    closure to be executed after delay.

    Return Value

    DispatchWorkItem task. You can call .cancel() on it to cancel delayed execution.

  • SwifterSwift: Debounce function or closure call.

    Declaration

    Swift

    public static func debounce(millisecondsDelay: Int, queue: DispatchQueue = .main, action: @escaping (() -> Void)) -> () -> Void

    Parameters

    millisecondsOffset

    allow execution of method if it was not called since millisecondsOffset.

    queue

    a queue that action closure should be executed on (default is DispatchQueue.main).

    action

    closure to be executed in a debounced way.

  • SwifterSwift: Called when user takes a screenshot

    Declaration

    Swift

    public static func didTakeScreenShot(_ action: @escaping (_ notification: Notification) -> Void)

    Parameters

    action

    a closure to run when user takes a screenshot

  • SwifterSwift: Class name of object as string.

    Declaration

    Swift

    public static func typeName(for object: Any) -> String

    Parameters

    object

    Any object to find its class name.

    Return Value

    Class name for given object.