Skip to content

Instantly share code, notes, and snippets.

@serhiybutz
Created September 24, 2021 08:34
Show Gist options
  • Save serhiybutz/ef9954be6571a9cdeec269a1004188a4 to your computer and use it in GitHub Desktop.
Save serhiybutz/ef9954be6571a9cdeec269a1004188a4 to your computer and use it in GitHub Desktop.
extension SharedManager {
public func borrow<A>(_ a: Property<A>,
accessBlock: (inout Accessor<A>) -> Void)
{
var _a = Accessor(a)
internalBorrow([a]) {
accessBlock(&_a)
}
}
public func borrow<A, B>(_ a: Property<A>,
_ b: Property<B>,
accessBlock: (inout Accessor<A>,
inout Accessor<B>) -> Void)
{
var _a = Accessor(a)
var _b = Accessor(b)
internalBorrow([a, b]) {
accessBlock(&_a, &_b)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment