Emptyable

public protocol Emptyable

Describes an object that be empty.

let str = ""
let retval = str.isEmpty

// so something with str which is true

Public Properties

  • Returns whether the receiver is empty.

    Declaration

    Swift

    var isEmpty: Bool { get }
  • isNotEmpty Extension method

    Returns whether the receiver is NOT empty.

    Declaration

    Swift

    var isNotEmpty: Bool { get }
  • nilIfEmpty Extension method

    Returns nil if the receiver is empty, otherwise returns the receiver.

    Declaration

    Swift

    var nilIfEmpty: Self? { get }