Optional

@_frozen
enum Optional<Wrapped> : ExpressibleByNilLiteral

Provides way to check empty without unwrapping

  • Checks to see whether the optional string is nil or empty (“”)

    Declaration

    Swift

    var isEmpty: Bool { get }
  • Return the actual string or empty if nil

    Declaration

    Swift

    var orEmpty: String { get }
  • Get a trimmed value of string

    Declaration

    Swift

    var trimmed: String { get }