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.

%25 Attribute Attribute ExpressibleByBooleanLiteral ExpressibleByBooleanLiteral Attribute->ExpressibleByBooleanLiteral XMLAttributeProtocol XMLAttributeProtocol Attribute->XMLAttributeProtocol ExpressibleByExtendedGraphemeClusterLiteral ExpressibleByExtendedGraphemeClusterLiteral Attribute->ExpressibleByExtendedGraphemeClusterLiteral Codable Codable Attribute->Codable ExpressibleByNilLiteral ExpressibleByNilLiteral Attribute->ExpressibleByNilLiteral ExpressibleByUnicodeScalarLiteral ExpressibleByUnicodeScalarLiteral Attribute->ExpressibleByUnicodeScalarLiteral XMLOptionalAttributeProtocol XMLOptionalAttributeProtocol Attribute->XMLOptionalAttributeProtocol ExpressibleByIntegerLiteral ExpressibleByIntegerLiteral Attribute->ExpressibleByIntegerLiteral 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