Skip to content

Instantly share code, notes, and snippets.

@josippetric
Created August 24, 2023 12:17
Show Gist options
  • Select an option

  • Save josippetric/9d0f312f978923297b4cbf4e59ae0487 to your computer and use it in GitHub Desktop.

Select an option

Save josippetric/9d0f312f978923297b4cbf4e59ae0487 to your computer and use it in GitHub Desktop.
Weak Reference Virtual Proxy
private final class WeakRefVirtualProxy<T: AnyObject> {
private weak var object: T?
init(object: T) {
self.object = object
}
}
extension WeakRefVirtualProxy: ConformingProtocol where T: ConformingProtocol {
func methodFromProtocol(aBoolProperty: Bool) {
object?.methodFromProtocol(aBoolProperty: aBoolProperty)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment