-
copy(with:for:)
Extension methodCreates a copy of this object, replacing the value at the given key path by the provided value.
Declaration
Swift
func copy<T>(with value: T, for path: WritableKeyPath<Self, T>) -> Self
Parameters
value
New value for the field in the copy.
path
Key path of the field that will be modified in the copy.
Return Value
A copy of this value with the modified field.