SassMap

Swift
public final class SassMap: SassValue

A Sass map value.

Sass maps are DictionaryDictionary-like collections. The keys can be any kind of SassValue.

When a map is viewed as a Sass list then the list is of two-element lists, one for each key-value pair in the map. The pairs are in no particular order.


Topics

Initializers

init([SassValue : SassValue])

Create a SassMap from an existing DictionaryDictionary.

Declaration
Swift
public init(_ dictionary: [SassValue: SassValue])

init<S>(uniqueKeysWithValues: S)

Create a SassMap from a sequence of (SassValue, SassValue) pairs.

The program terminates if the keys are not unique.

Declaration
Swift
public init<S>(uniqueKeysWithValues keysAndValues: S)
where S: Sequence, S.Element == (SassValue, SassValue)

Properties

var dictionary: [SassValue : SassValue]

The dictionary of values.

Declaration
Swift
public let dictionary: [SassValue: SassValue]

var separator: SassList.Separator

The list separator used by this value when viewed as a list.

Declaration
Swift
public override var separator: SassList.Separator { get }

var listCount: Int

The number of values in this value viewed as a list.

Declaration
Swift
public override var listCount: Int { get }

Access

subscript(key: SassValue) -> SassValue?

Return the value corresponding to the given key, or nil if the map does not have the key.

Declaration
Swift
public subscript(key: SassValue) -> SassValue? { get }

func valueAt(sassIndex: SassValue) -> SassValue

warning

this method uses sassIndex to numerically index into the list representation of this map. To access the map via its keys use subscript(_:) or dictionary directly.

Declaration
Swift
public override func valueAt(sassIndex: SassValue) throws -> SassValue

Misc

static func ==(lhs: SassMap, rhs: SassMap) -> Bool

List equality: two SassMaps are equal if their dictionaries are equivalent.

Declaration
Swift
public static func == (lhs: SassMap, rhs: SassMap) -> Bool

func hash(into: inout Hasher)

Hashes the map’s contents

Declaration
Swift
public override func hash(into hasher: inout Hasher)

func makeIterator() -> AnyIterator<SassValue>

An iterator for contents of the map. Each element of the iteration is a SassList containing the key and value SassValues for one entry in the map.

Declaration
Swift
public override func makeIterator() -> AnyIterator<SassValue>

func accept<V, R>(visitor: V) -> R

Call the corresponding method of visitor against this object.

Declaration
Swift
public override func accept<V, R>(visitor: V) throws -> R
where V: SassValueVisitor, R == V.ReturnType

var description: String

A short description of the value.

Declaration
Swift
public override var description: String { get }