Functions

The following functions are available globally.

  • Converts a string of hexadecimal digits to a Swift array.

    Declaration

    Swift

    public func arrayFromHexString(s : String) -> [UInt8]

    Parameters

    s

    the hex string (must contain an even number of digits)

    Return Value

    a Swift array

  • Converts a string of hexadecimal digits to an NSData object.

    Declaration

    Swift

    public func dataFromHexString(s : String) -> NSData

    Parameters

    s

    the hex string (must contain an even number of digits)

    Return Value

    an NSData object

  • Converts a Swift array to an NSData object.

    Declaration

    Swift

    public func dataFromByteArray(a : [UInt8]) -> NSData

    Parameters

    a

    the Swift array

    Return Value

    an NSData object

  • Converts a Swift array to a string of hexadecimal digits.

    Declaration

    Swift

    public func hexStringFromArray(a : [UInt8], uppercase : Bool = false) -> String

    Parameters

    a

    the Swift array

    uppercase

    if true use uppercase for letter digits, lowercase otherwise

    Return Value

    a Swift string

  • Converts a Swift array to an NSString object.

    Declaration

    Swift

    public func hexNSStringFromArray(a : [UInt8], uppercase : Bool = false) -> NSString

    Parameters

    a

    the Swift array

    uppercase

    if true use uppercase for letter digits, lowercase otherwise

    Return Value

    an NSString object

  • Converts a Swift array to a Swift String containing a comma separated list of bytes. This is used to generate test data programmatically.

    Declaration

    Swift

    public func hexListFromArray(a : [UInt8]) -> String

    Parameters

    a

    the Swift array

    Return Value

    a Swift string