Dealing with Selectors in Swift

I ran into a road block trying to figure out how to deal with selectors in Swift today and finally figured out how to get them to work.

Hopefully this helps some of you out there. If there are any other ways to do this or more efficient ways, please let me know.


[[UIButton alloc]
    initWithTitle: "Some Title"
    style: UIBarButtonItemStyle.Done
    target: self
    action: @selector(someMethod)]


    title: "Some Title",
    style: UIBarButtonItemStyle.Done,
    target: self,
    action: "someMethod"

Clemente Gomez

Twitter: @kreativeking

Hi, I'm a professional Web and Mobile Developer. I play music, cycle, game and paint from time to time. Follow me on twitter for impromptu brain thoughts. =D

comments powered by Disqus