Structure
LeafData
LeafData is a “pseudo-protocol” wrapping the physically storable Swift data types Leaf can use directlystruct LeafData
Overview
(Bool, Int, Double, String, Array, Dictionary, Data)are the inherent root types supported, all of which may also be representable asOptionalvalues.NaturalTypepresents these cases plusVoidas a case for functionalLeafSymbolsnilis creatable, but only within context of a root base type - eg,.nil(.bool)==Bool?
Topics
Operators
==(_:_:)Returns a Boolean value indicating whether two values are equal.
Initializers
init(_:)init(arrayLiteral:)Creates an instance initialized with the given elements.init(booleanLiteral:)Creates an instance initialized to the given Boolean value.init(dictionaryLiteral:)Creates an instance initialized with the given key-value pairs.init(floatLiteral:)Creates an instance initialized to the specified floating-point value.init(integerLiteral:)Creates an instance initialized to the specified integer value.init(nilLiteral:)Creates an instance initialized withnil.init(stringLiteral:)Creates an instance initialized to the given string value.
Instance Properties
arrayAttempts to convert to[LeafData]or returnsnil.boolAttempts to convert toBoolor returnsnil.celfThe case-self identitydataAttempts to convert toDataor returnsnil.descriptionA textual representation of this instance.dictionaryAttempts to convert to[String: LeafData]or returnsnil.doubleAttempts to convert toDoubleor returnsnil.hasUniformTypeReturnstrueif the object has a single uniform typeintAttempts to convert toIntor returnsnil.isCollectionReturnstrueif the data can hold other data - we don’t considerOptionalfor this purposeisNilReturnstrueif the data isnilorvoid.shortstringAttempts to convert toStringor returnsnil.uniformTypeReturns the uniform type of the object, or nil if it is a non-uniform container
Instance Methods
cast(to:)coerce(to:)isCastable(to:)Returnstrueif concrete object can be exactly or losslessly cast to a second typeisCoercible(to:)Returnstrueif concrete object is potentially directly coercible to a second type in some way
Type Properties
trueNilFor convenience,trueNilis stored as.optional(nil, .void)
Type Methods
array(_:)Creates a newLeafDatafrom[LeafData].bool(_:)Creates a newLeafDatafrom aBool.data(_:)Creates a newLeafDatafromData.dictionary(_:)Creates a newLeafDatafrom[String: LeafData].double(_:)Creates a newLeafDatafrom aDouble.int(_:)Creates a newLeafDatafrom amInt.nil(_:)Creates a newLeafDataforOptional<LeafData>string(_:)Creates a newLeafDatafrom aString.
Enumerations
LeafData.NaturalTypeThe concrete instantiable object types for aLeafData
Relationships
Conforms To
Swift.CustomStringConvertibleSwift.EquatableSwift.ExpressibleByArrayLiteralSwift.ExpressibleByBooleanLiteralSwift.ExpressibleByDictionaryLiteralSwift.ExpressibleByExtendedGraphemeClusterLiteralSwift.ExpressibleByFloatLiteralSwift.ExpressibleByIntegerLiteralSwift.ExpressibleByNilLiteralSwift.ExpressibleByStringLiteralSwift.ExpressibleByUnicodeScalarLiteralSwift.SendableSwift.SendableMetatype