Structure

JSONEncoder.OutputFormatting

The output formatting options that determine the readability, size, and element order of an encoded JSON object.

Declaration

struct JSONEncoder.OutputFormatting

Topics

Formatting Output

static let prettyPrinted: JSONEncoder.OutputFormatting

The output formatting option that uses ample white space and indentation to make output easy to read.

static let sortedKeys: JSONEncoder.OutputFormatting

The output formatting option that sorts keys in lexicographic order.

Creating Options

init(rawValue: UInt)

Creates a new set of output formatting options from the given raw value.

let rawValue: UInt

A raw value representing a set of output formatting options.

init()

Creates an empty option set.

init(arrayLiteral: JSONEncoder.OutputFormatting...)

Creates a set containing the elements of the given array literal.

Checking Options

func contains(JSONEncoder.OutputFormatting) -> Bool

Returns a Boolean value that indicates whether a given element is a member of the option set.

var isEmpty: Bool

A Boolean value that indicates whether the set has no elements.

Adding and Removing Options

Combining Options

func union(JSONEncoder.OutputFormatting) -> JSONEncoder.OutputFormatting

Returns a new option set of the elements contained in this set, in the given set, or in both.

func formUnion(JSONEncoder.OutputFormatting)

Inserts the elements of another set into this option set.

func intersection(JSONEncoder.OutputFormatting) -> JSONEncoder.OutputFormatting

Returns a new option set with only the elements contained in both this set and the given set.

func formIntersection(JSONEncoder.OutputFormatting)

Removes all elements of this option set that are not also present in the given set.

func symmetricDifference(JSONEncoder.OutputFormatting) -> JSONEncoder.OutputFormatting

Returns a new option set with the elements contained in this set or in the given set, but not in both.

func formSymmetricDifference(JSONEncoder.OutputFormatting)

Replaces this set with a new set containing all elements contained in either this set or the given set, but not in both.

func subtracting(JSONEncoder.OutputFormatting) -> JSONEncoder.OutputFormatting

Returns a new set containing the elements of this set that do not occur in the given set.

func subtract(JSONEncoder.OutputFormatting)

Removes the elements of the given set from this set.

Comparing Options

func isSubset(of: JSONEncoder.OutputFormatting) -> Bool

Returns a Boolean value that indicates whether the set is a subset of another set.

func isStrictSubset(of: JSONEncoder.OutputFormatting) -> Bool

Returns a Boolean value that indicates whether this set is a strict subset of the given set.

func isSuperset(of: JSONEncoder.OutputFormatting) -> Bool

Returns a Boolean value that indicates whether the set is a superset of the given set.

func isStrictSuperset(of: JSONEncoder.OutputFormatting) -> Bool

Returns a Boolean value that indicates whether this set is a strict superset of the given set.

func isDisjoint(with: JSONEncoder.OutputFormatting) -> Bool

Returns a Boolean value that indicates whether the set has no members in common with the given set.

static func != (JSONEncoder.OutputFormatting, JSONEncoder.OutputFormatting) -> Bool

Returns a Boolean value indicating whether two values are not equal.

Initializers

init<S>(S)

Creates a new set from a finite sequence of items.

Relationships

Conforms To

See Also

Customizing Encoding

var outputFormatting: JSONEncoder.OutputFormatting

A value that determines the readability, size, and element order of the encoded JSON object.

var keyEncodingStrategy: JSONEncoder.KeyEncodingStrategy

A value that determines how a type's coding keys are encoded as JSON keys.

enum JSONEncoder.KeyEncodingStrategy

The values that determine how a type's coding keys are encoded as JSON keys.

var userInfo: [CodingUserInfoKey : Any]

A dictionary you use to customize the encoding process by providing contextual information.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software