XMLCoder Documentation

Structure Attribute

@propertyWrapper
public struct Attribute<Value>: XMLAttributeProtocol  

Property wrapper specifying that a given property should be encoded and decoded as an XML attribute.

For example, this type

struct Book: Codable {
    @Attribute var id: Int
}

will encode value Book(id: 42) as <Book id="42"></Book>. And vice versa, it will decode the former into the latter.

%3 Attribute Attribute ExpressibleByUnicodeScalarLiteral ExpressibleByUnicodeScalarLiteral Attribute->ExpressibleByUnicodeScalarLiteral Codable Codable Attribute->Codable ExpressibleByNilLiteral ExpressibleByNilLiteral Attribute->ExpressibleByNilLiteral XMLOptionalAttributeProtocol XMLOptionalAttributeProtocol Attribute->XMLOptionalAttributeProtocol ExpressibleByBooleanLiteral ExpressibleByBooleanLiteral Attribute->ExpressibleByBooleanLiteral ExpressibleByIntegerLiteral ExpressibleByIntegerLiteral Attribute->ExpressibleByIntegerLiteral XMLAttributeProtocol XMLAttributeProtocol Attribute->XMLAttributeProtocol ExpressibleByExtendedGraphemeClusterLiteral ExpressibleByExtendedGraphemeClusterLiteral Attribute->ExpressibleByExtendedGraphemeClusterLiteral ExpressibleByStringLiteral ExpressibleByStringLiteral Attribute->ExpressibleByStringLiteral

Conforms To

Codable
ExpressibleByBooleanLiteral
ExpressibleByExtendedGraphemeClusterLiteral
ExpressibleByIntegerLiteral
ExpressibleByNilLiteral
ExpressibleByStringLiteral
ExpressibleByUnicodeScalarLiteral

Initializers

init(_:​)

public init(_ wrappedValue: Value)  

Properties

wrapped​Value

public var wrappedValue: Value