Created
July 7, 2020 07:47
-
-
Save mehmetfarhan/52d90069b97fdf5fc19295563e65859a to your computer and use it in GitHub Desktop.
Buildable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public protocol Buildable { } | |
public extension Buildable where Self: AnyObject { | |
func with<T>( | |
_ property: ReferenceWritableKeyPath<Self, T>, | |
_ value: T | |
) -> Self { | |
self[keyPath: property] = value | |
return self | |
} | |
} | |
extension NSObject: Buildable { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment