Data

struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessCollection, MutableCollection, RangeReplaceableCollection

This extension add some useful functions to Data.

  • Convert self to a UTF8 String.

    Declaration

    Swift

    public func utf8() -> String?

    Return Value

    Returns self as UTF8 NSString.

  • Convert self to a ASCII String.

    Declaration

    Swift

    public func ascii() -> String?

    Return Value

    Returns self as ASCII String.

  • Convert self UUID to String.

    Useful for push notifications.

    Declaration

    Swift

    public func readableUUID() -> String

    Return Value

    Returns self as String from UUID.