Data

Extends Data to support the Action Data controls and adds convenience methods for working with data properties in a Codable, Encodable or Decodable class.

Examples:

// Assign data from an image in iOS, tvOS or watchOS
let imageData: Data ~= UIImage(named: "Background.png")
  • Sets the Data instance from the given UIImage instance.

    Examples:

    // Assign data from an image in iOS, tvOS or watchOS
    let imageData: Data ~= UIImage(named: "Background.png")
    

    Declaration

    Swift

    public static func ~= ( left: inout Data, right: UIImage)
  • Attempts to create a UIImage from the data stored in the current Data instance. Returns the Image if it can be created else returns nil.

    Examples:

    // Assign data from an image in iOS, tvOS or watchOS
    let imageData: Data ~= UIImage(named: "Background.png")
    if let image = imageData.uiImage {
       ...
    }
    

    Declaration

    Swift

    public var uiImage: UIImage?