refactored naming
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
052d7b57b0
commit
6156ed18fd
@ -37,12 +37,12 @@ public protocol Withable {
|
||||
/// Provides a closure to configure instances inline.
|
||||
/// - Parameter closure: A closure with a mutable copy of `self` as the argument.
|
||||
/// - Returns: Simply returns the mutated copy of the instance after called the `closure`.
|
||||
@discardableResult func with(_ closure: (_ instance: inout T) -> Void) -> T
|
||||
@discardableResult func copyWith(_ closure: (_ instance: inout T) -> Void) -> T
|
||||
}
|
||||
|
||||
public extension Withable {
|
||||
|
||||
@discardableResult func with(_ closure: (_ instance: inout Self) -> Void) -> Self {
|
||||
@discardableResult func copyWith(_ closure: (_ instance: inout Self) -> Void) -> Self {
|
||||
var copy = self
|
||||
closure(©)
|
||||
return copy
|
||||
|
||||
Loading…
Reference in New Issue
Block a user