Skip to content

Instantly share code, notes, and snippets.

@Le0nX
Created February 20, 2020 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Le0nX/d88287100d77d9b802ead7ef5b1e5a30 to your computer and use it in GitHub Desktop.
Save Le0nX/d88287100d77d9b802ead7ef5b1e5a30 to your computer and use it in GitHub Desktop.
Virtual proxy pattern
final class WeakReference<T: AnyObject> {
weak var ref: T?
init (_ object: T) {
self.ref = object
}
}
extension WeakReference: CurrencyPresenterOutput where T: CurrencyPresenterOutput {
func present(_ currency: CurrencyPresenterModel) {
ref?.present(currency)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment