Lens
public protocol Lens
Types that represent, in the type system, a specific key path value.
A given Lens-conforming type’s associated key path value is provided by its static var
focus.
-
The specific subclass of
KeyPath<Focus.Root,Value>whose valueSelfrepresents.For example,
Focusmight beWritableKeyPath<(Int, String), Int>in aLensthat supported writing.Declaration
Swift
associatedtype Focus : KeyPathProtocol -
The
Valuetype of the represented key path.Models of
Lensshould not define this type, but instead allow the default to take effect.Declaration
Swift
associatedtype Value = Self.Focus.Value -
The key path value represented by
Self.Declaration
Swift
static var focus: Focus { get }
View on GitHub
Lens Protocol Reference