Selector and UIButton in swift

swift 3.0

Given

should now be written as

If you were to follow swift 3 guidelines for declaring functions

in that case, we’ll have to declare our selector like so:

In a Single View App

If you want to pass in additional information into the sample function, you can over-ride UIButton with your custom button class and set a property there.
Then, when you get your button object in sample function, just access that property.