Functions

The following functions are available globally.

  • Returns a Boolean value indicating whether the font names of two UIFontProvider font text styles are equal.

    Declaration

    Swift

    public func == (lhs: UIFontProvider?, rhs: UIFontProvider?) -> Bool
  • Sets an associated value for a given object using a given key and association policy, whether it is a value type or a class.

    Note

    It uses the objc runtime through objc_setAssociatedObject, but wraps the value if it is a struct.

    Warning

    Using associated objects should be avoided, as they are used in runtime and not in compile time, and could lead to performance issues.

    Declaration

    Swift

    public func setAssociatedObject<T>(_ object: AnyObject, key: UnsafeRawPointer, value: T?, policy: objc_AssociationPolicy = .OBJC_ASSOCIATION_RETAIN)

    Parameters

    object

    The source object for the association.

    value

    The value to associate with the key for object.

    key

    The key for the association.

    policy

    The policy for the association.

  • Returns the value associated with a given object for a given key, whether it is a value type or a class.

    Note

    It uses the objc runtime through objc_setAssociatedObject, but wraps the object if it is a struct.

    Warning

    Using associated objects should be avoided, as they are used in runtime and not in compile time, and could lead to performance issues.

    Declaration

    Swift

    public func getAssociatedObject<T>(_ object: AnyObject, key: UnsafeRawPointer) -> T?

    Parameters

    object

    The source object for the association.

    key

    The key for the association.

    Return Value

    The value associated with the key key for object.

  • Returns the type’s simple name. That is to say: without scope prefixes, without properties’ values if it’s a struct.

    Declaration

    Swift

    public func SimpleName(ofType type: Any.Type) -> String
  • Returns the concrete type’s simple name. That is to say: without scope prefixes, without properties’ values if it’s a struct.

    Seealso

    type(of:)

    Declaration

    Swift

    public func SimpleName<T>(of element: T) -> String
  • Returns the concatenation of the given NSAttributedStrings

    Declaration

    Swift

    public func + (left: NSAttributedString, right: NSAttributedString) -> NSAttributedString
  • Convenience method to grab the main thread and perform closure

    For more information on why do we need to use this see: https://medium.com/@johnsundell/reducing-flakiness-in-swift-tests-5942e5677394

    Declaration

    Swift

    func performUIUpdate(using closure: @escaping () -> Void)

    Parameters

    closure

    the closure to execute

  • Appends a path component to the string, similar to web resource addressing.

    Seealso

    appendingPathComponent from NSString.

    Declaration

    Swift

    public func / (basePath: String, pathComponent: PathAppendable) -> String

    Parameters

    basePath

    base string.

    pathComponent

    PathAppendable that will be appended.

    Return Value

    The new String, with pathComponent appended to basePath.

  • Appends a path component to a URL.

    Declaration

    Swift

    public func / (baseURL: URL, pathComponent: PathAppendable) -> URL

    Parameters

    baseURL

    base URL.

    pathComponent

    PathAppendable that will be appended.

    Return Value

    The new URL, with pathComponent appended to baseURL