Last active
November 29, 2017 19:36
-
-
Save irace/8e640774596c0abc25fed6c025be4df9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import Foundation | |
/** | |
A wrapper around a target/action pair, holding the target weakly since the target (e.g. a view controller) often holds | |
a strong reference to the object that ends up owning the `WeakTargetAction` instance (e.g. a view). | |
*/ | |
public final class WeakTargetAction { | |
weak var target: AnyObject? | |
let action: Selector | |
public init(target: AnyObject, action: Selector) { | |
self.target = target | |
self.action = action | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment