Created
April 28, 2016 16:01
-
-
Save maxcampolo/b36680f16b8a58d0626c57232290955f to your computer and use it in GitHub Desktop.
Performing selector after delay and cancelling previous perform requests in Swift.
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
// Perform selector | |
self.performSelector(#selector(MyViewController.myFunction(_:)), withObject: myObject, afterDelay: 1.0) | |
// Cancel perform requests | |
self.classForCoder.cancelPreviousPerformRequestsWithTarget(self, selector: #selector(MyViewController.myFunction(_:)), object: myObject) | |
// Note: - | |
// myObject can be nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment