Data

@frozen
struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessCollection, MutableCollection, RangeReplaceableCollection, MutableDataProtocol, ContiguousBytes
  • SwifterSwift: Return data as an array of bytes.

    Declaration

    Swift

    var bytes: [UInt8] { get }
  • SwifterSwift: String by encoding Data using the given encoding (if applicable).

    Declaration

    Swift

    func string(encoding: String.Encoding) -> String?

    Parameters

    encoding

    encoding.

    Return Value

    String by encoding Data using the given encoding (if applicable).

  • SwifterSwift: Returns a Foundation object from given JSON data.

    For possible values, see JSONSerialization.ReadingOptions.

    Throws

    An NSError if the receiver does not represent a valid JSON object.

    Declaration

    Swift

    func jsonObject(options: JSONSerialization.ReadingOptions = []) throws -> Any

    Parameters

    options

    Options for reading the JSON data and creating the Foundation object.

    Return Value

    A Foundation object from the JSON data in the receiver, or nil if an error occurs.