Functions

The following functions are available globally.

  • Adding String to attributed string as text

    Declaration

    Swift

    public func + (lhs: NSAttributedString, rhs: NSAttributedString) -> NSAttributedString
  • Run сlosure after particular time period

    Declaration

    Swift

    public func runThisAfterDelay(seconds: Double, after: @escaping () -> Void)

    Parameters

    seconds

    time in double format

    after

    closure which will be executed after

  • Run сlosure in the main thread, usefull for UI changes

    Declaration

    Swift

    public func runThisInMainThread(_ block: @escaping () -> Void)

    Parameters

    block

    closure to be executed in Main thread, enshure exit from retain circles

  • Run сlosure in the background thread, usefull for long time period tasks

    Declaration

    Swift

    public func runThisInBackground(_ block: @escaping () -> Void)

    Parameters

    block

    closure to be executed in Background thread, enshure exit from retain circles

  • Run сlosure every particular time after the time period

    Declaration

    Swift

    public  func runThisEvery(seconds: TimeInterval, startAfterSeconds: TimeInterval, handler: @escaping (CFRunLoopTimer?) -> Void) -> Timer

    Parameters

    seconds

    code will be executed every this double format value of time

    startAfterSeconds

    code will be executed in loop after this time period in double format

    handler

    closure to be executed in Background thread, enshure exit from retain circles

  • Run backgoundClosure async in global queue, then completionClosure async in main queue

    Declaration

    Swift

    public func asyncGlobal (_ backgroundClosure: @escaping () -> Void, _ completionClosure: @escaping (() -> Void) )

    Parameters

    backgroundClosure

    payload closure

    completionClosure

    completion closure

  • Run backgoundClosure async in global queue

    Declaration

    Swift

    public func asyncGlobal (_ backgroundClosure: @escaping () -> Void)

    Parameters

    backgroundClosure

    payload closure

  • Run backgoundClosure async in global queue, then calls completionClosure async in main queue with result of backgroundClosure

    Declaration

    Swift

    public func asyncGlobal<R> (_ backgroundClosure: @escaping () -> R, _ completionClosure: @escaping ((_ result: R) -> Void) )

    Parameters

    backgroundClosure

    payload closure with result

    completionClosure

    completion closure with parameter

  • Run backgoundClosure sync in main queue

    Declaration

    Swift

    public func syncMain (_ backgroundClosure: @escaping () -> Void )

    Parameters

    backgroundClosure

    <#backgroundClosure description#>

  • Run backgoundClosure async in main queue, then calls completionClosure

    Declaration

    Swift

    public func asyncMain (_ backgroundClosure: @escaping () -> Void, _ completionClosure: @escaping (() -> Void) )

    Parameters

    backgroundClosure

    payload closure

    completionClosure

    completion closure

  • Run backgoundClosure async in main queue

    Declaration

    Swift

    public func asyncMain (_ backgroundClosure: @escaping () -> Void )

    Parameters

    backgroundClosure

    payload closure

  • Run backgoundClosure async in main queue, then calls completionClosure with result of backgroundClosure

    Declaration

    Swift

    public func asyncMain<R> (_ backgroundClosure: @escaping () -> R, _ completionClosure: @escaping ((_ result: R) -> Void) )

    Parameters

    backgroundClosure

    payload closure with result

    completionClosure

    completion closure with parameter

  • Brackets call of closure in objc_sync_enter and objc_sync_exit calls, assotiated with object

    Declaration

    Swift

    public func syncCritical(_ object: Any, _ closure: () -> Void)

    Parameters

    object

    Object used as lock souorce

    closure

    Closure to execute while lock is active

  • Executes right part with left part as an argument, returns retult of execution (not Optional)

    See more

    Declaration

    Swift

    public func --> <T, U>(left: T, right: (T) -> U) -> U

    Parameters

    left

    Source value

    right

    Closue to execute

    Return Value

    Result of left closure

  • Executes right part with left part as an argument, returns retult of execution (Optional)

    See more

    Declaration

    Swift

    public func --> <T, U>(left: T?, right: (T?) -> U?) -> U?

    Parameters

    left

    Source value

    right

    Closue to execute

    Return Value

    Result of left closure

  • Executes right part with left part as an argument, returns left part (not Optional)

    See more

    Declaration

    Swift

    public func --> <T>(left: T, right: (T) -> Void) -> T

    Parameters

    left

    Source value

    right

    Closue to execute

    Return Value

    Result of left closure

  • Executes right part with left part as an argument, returns left part (Optional)

    See more

    Declaration

    Swift

    public func --> <T>(left: T?, right: (T?) -> Void) -> T?

    Parameters

    left

    Source value

    right

    Closue to execute

    Return Value

    Result of left closure

  • Additional date comparision operators (greater or equal)

    Declaration

    Swift

    public func >= (left: Date, right: Date) -> Bool
  • Additional date comparision operators (lesser or equal)

    Declaration

    Swift

    public func <= (left: Date, right: Date) -> Bool
  • Pattern matching of strings via defined functions

    Declaration

    Swift

    public func ~=<T> (pattern: ((T) -> Bool), value: T) -> Bool
  • Can be used in switch-case

    Declaration

    Swift

    public func hasPrefix(_ prefix: String) -> (_ value: String) -> Bool
  • Can be used in switch-case

    Declaration

    Swift

    public func hasSuffix(_ suffix: String) -> (_ value: String) -> Bool
  • Combines the first dictionary with the second and returns single dictionary

    See more

    Declaration

    Swift

    public func += <KeyType, ValueType> (left: inout [KeyType: ValueType], right: [KeyType: ValueType])
  • Difference operator

    See more

    Declaration

    Swift

    public func - <K, V: Equatable> (first: [K: V], second: [K: V]) -> [K: V]