Map

public final class Map

A class used for holding mapping data

  • Undocumented

    Declaration

    Swift

    public let mappingType: MappingType
  • Undocumented

    Declaration

    Swift

    public internal(set) var JSON: [String: Any] = [:]
  • Undocumented

    Declaration

    Swift

    public internal(set) var isKeyPresent = false
  • Undocumented

    Declaration

    Swift

    public internal(set) var currentValue: Any?
  • Undocumented

    Declaration

    Swift

    public internal(set) var currentKey: String?
  • Undocumented

    Declaration

    Swift

    var keyIsNested = false
  • Undocumented

    Declaration

    Swift

    public internal(set) var nestedKeyDelimiter: String = "."
  • Undocumented

    Declaration

    Swift

    public var context: MapContext?
  • Undocumented

    Declaration

    Swift

    public var shouldIncludeNilValues = false  /// If this is set to true, toJSON output will include null values for any variables that are not set.
  • If this is set to true, toJSON output will include null values for any variables that are not set.

    Declaration

    Swift

    let toObject: Bool // indicates whether the mapping is being applied to an existing object
  • Undocumented

    Declaration

    Swift

    public init(mappingType: MappingType, JSON: [String: Any], toObject: Bool = false, context: MapContext? = nil, shouldIncludeNilValues: Bool = false)
  • Sets the current mapper value and key. The Key paramater can be a period separated string (ex. distance.value) to access sub objects.

    Declaration

    Swift

    public subscript(key: String) -> Map
  • Undocumented

    Declaration

    Swift

    public func value<T>() -> T?
  • Returns a value or throws an error.

    Declaration

    Swift

    public func value<T>(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> T
  • Returns a transformed value or throws an error.

    Declaration

    Swift

    public func value<Transform: TransformType>(_ key: String, nested: Bool? = nil, delimiter: String = ".", using transform: Transform, file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> Transform.Object
  • Returns a RawRepresentable type or throws an error.

    Declaration

    Swift

    public func value<T: RawRepresentable>(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> T
  • Returns a [BaseMappable] or throws an error.

    Declaration

    Swift

    public func value<T: BaseMappable>(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [T]
  • Returns a [BaseMappable] using transform or throws an error.

    Declaration

    Swift

    public func value<Transform: TransformType>(_ key: String, nested: Bool? = nil, delimiter: String = ".", using transform: Transform, file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [Transform.Object]
  • Returns a [String: BaseMappable] or throws an error.

    Declaration

    Swift

    public func value<T: BaseMappable>(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [String: T]
  • Returns a [String: BaseMappable] using transform or throws an error.

    Declaration

    Swift

    public func value<Transform: TransformType>(_ key: String, nested: Bool? = nil, delimiter: String = ".", using transform: Transform, file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [String: Transform.Object]