Skip to content

Instance Subscript

subscript(dynamicMember:)

An @dynamicMemberLookup subscript which enables direct access to the values of individual properties of self.model without having to actually add .model to each usage.
subscript<Value>(dynamicMember keyPath: KeyPath<Self.Model, Value>) -> Value { get }

Overview

The presence of subscript(dynamicMember:) and this subscript together enables nearly transparent use of a ModelAlias type as if it were the underlying Model type.

Example:

let alias = HomeTeam()
print(alias.name) // fatalError("Cannot access field before it is initialized or fetched: name")