Vapor Documentation Beta

Protocol Extendable

public protocol Extendable: class

Types conforming to Extendable can have stored properties added in extension by using the Extend struct.

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

Conforms To

class

Requirements

extend

var extend: Extend

Arbitrary property storage. See Extend and Extendable.