The Cocoa’s target/action pattern works great with Objective-C, but can be difficult to work within Swift.
Mike ash has written a tutorial on implementing the target/action pattern in Swift for working with Cocoa, and avoiding memory management issues.
In the tutorial Mike shows how to implement the target/action pattern in Swift, and provides an example of how one could use it with UIKit, with a specific example of UIButton.
You can find the tutorial over on Mike Ash’s blog.
A nice guide for implementing the target/action pattern in Swift for working with Cocoa.
Original article: Tutorial: Implementing The Target/Action Pattern In Swift And Using It With Cocoa
©2016 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.