subscript(dynamicMember:)

Returns a shared reference to the resulting value of a given key path.

Shared.swift:242
subscript<Member>(dynamicMember keyPath: WritableKeyPath<Value, Member>) -> Shared<Member> { get }

Parameters

keyPath

A key path to a specific resulting value.

Returns

A new shared reference.

You don’t call this subscript directly. Instead, Swift calls it for you when you access a property of the underlying value. In the following example, the property access $signUpData.topics returns the value of invoking this subscript with \SignUpData.topics:

@Shared var signUpData: SignUpData

$signUpData.topics  // Shared<Set<Topic>>