String

struct String

The String extension class adds support for Base32 decoding and encoding and localized string translations.

  • The String instance as a Data.

    Declaration

    Swift

    public var dataValue: Data? { get }
  • This extension method wraps NSLocalizedString returning the translated text.

    Declaration

    Swift

    public static func localize(_ key: String, comment: String = "") -> String

    Parameters

    key

    The key for a string in the default table.

    comment

    The comment to place above the key-value pair in the strings file.

    Return Value

    Returns a localized version of a string.

  • This extension method wraps NSLocalizedString returning the translated text.

    Declaration

    Swift

    public static func localize(_ key: String, comment: String = "", bundle: Bundle = Bundle.main) -> String

    Parameters

    key

    The key for a string in the default table.

    bundle

    The bundle containing the localised strings.

    comment

    The comment to place above the key-value pair in the strings file.

    Return Value

    Returns a localized version of a string.

  • A percent escaped value for form encoding.

    Remark

    The encoding supports Base64 string values. Does not include ? or / due to RFC 3986 - Section 3.4

    Declaration

    Swift

    public var urlSafeEncodedValue: String { get }
  • Returns a Data decoded from a base32 string.

    Declaration

    Swift

    public var base32DecodedData: Data? { get }