Skip to content

Structure

Extend

A wrapper around a simple [String: Any] storage dictionary used to implement Extendable.
struct Extend

Overview

final cass MyType: Extendable { ... }
extension MyType {
    var foo: Int {
        get { return extend.get(\MyType.foo, default: 0) }
        set { extend.set(\MyType.foo, to: newValue) }
    }
}

Note

Extend conforms to Codable, but will yield an empty dictionary. Extensions are used for convenience and should not be encoded or decoded.

Topics

Initializers

Instance Properties

Instance Methods

  • encode(to:)
    See Codable.
  • get(_:default:)
    Gets a value from the Extend storage falling back to the default value if it does not exist or cannot be casted to T.
  • set(_:to:)
    Set a value to the Extend storage.

Subscripts

  • subscript(_:)
    Allow subscripting by String key. This is a type-erased alternative to the get(_:default:) and set(:to:) methods.

Relationships

Conforms To

  • Swift.Decodable
  • Swift.Encodable
  • Swift.ExpressibleByDictionaryLiteral