WatchOS WKInterface Button

I am developing this app for watchOS that has multiple buttons. Each button should execute exactly the same set of code, being the only difference between them the set of data they pull from a dictionary stored within the app’s bundle. The only way I see doing this is by inserting a bunch of IBAction methods, one for each button. However it is not the smartest way to do that. Any other ideas?


You can actually link them all to the same IBOutlet!

Give each button a “tag” just in the attributes inspector.

In the IBOutlet, use a switch statement on sender.tag (I believe)
And then you can see which one was selected and from there change which part of the dictionary you’re going to

I am referring to Watchkit (WatchOS) where tagging a button is not possible! Any other ideas?

My bad! I didn’t know that part didn’t translate to WatchOS

The only thing I can think of is having an IBAction for each, but call the same function with them all, and pass parameters to that function