{"action":"opened","issue":{"url":"https://api.github.com/repos/lionheart/openradar-mirror/issues/2343","labels_url":"https://api.github.com/repos/lionheart/openradar-mirror/issues/2343/labels{/name}","comments_url":"https://api.github.com/repos/lionheart/openradar-mirror/issues/2343/comments","events_url":"https://api.github.com/repos/lionheart/openradar-mirror/issues/2343/events","html_url":"https://github.com/lionheart/openradar-mirror/issues/2343","id":98808635,"number":2343,"title":"19415424: WatchKit: WKInterfaceButton Doesn’t Pass Reference to IBAction Method","user":{"login":"openradar-mirror","id":13605213,"avatar_url":"https://avatars.githubusercontent.com/u/13605213?v=3","gravatar_id":"","url":"https://api.github.com/users/openradar-mirror","html_url":"https://github.com/openradar-mirror","followers_url":"https://api.github.com/users/openradar-mirror/followers","following_url":"https://api.github.com/users/openradar-mirror/following{/other_user}","gists_url":"https://api.github.com/users/openradar-mirror/gists{/gist_id}","starred_url":"https://api.github.com/users/openradar-mirror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openradar-mirror/subscriptions","organizations_url":"https://api.github.com/users/openradar-mirror/orgs","repos_url":"https://api.github.com/users/openradar-mirror/repos","events_url":"https://api.github.com/users/openradar-mirror/events{/privacy}","received_events_url":"https://api.github.com/users/openradar-mirror/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lionheart/openradar-mirror/labels/classification:enhancement","name":"classification:enhancement","color":"207de5"},{"url":"https://api.github.com/repos/lionheart/openradar-mirror/labels/reproducible:always","name":"reproducible:always","color":"5319e7"},{"url":"https://api.github.com/repos/lionheart/openradar-mirror/labels/status:open","name":"status:open","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/lionheart/openradar-mirror/milestones/4","html_url":"https://github.com/lionheart/openradar-mirror/milestones/iOS%20SDK","labels_url":"https://api.github.com/repos/lionheart/openradar-mirror/milestones/4/labels","id":1237418,"number":4,"title":"iOS SDK","description":null,"creator":{"login":"openradar-mirror","id":13605213,"avatar_url":"https://avatars.githubusercontent.com/u/13605213?v=3","gravatar_id":"","url":"https://api.github.com/users/openradar-mirror","html_url":"https://github.com/openradar-mirror","followers_url":"https://api.github.com/users/openradar-mirror/followers","following_url":"https://api.github.com/users/openradar-mirror/following{/other_user}","gists_url":"https://api.github.com/users/openradar-mirror/gists{/gist_id}","starred_url":"https://api.github.com/users/openradar-mirror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openradar-mirror/subscriptions","organizations_url":"https://api.github.com/users/openradar-mirror/orgs","repos_url":"https://api.github.com/users/openradar-mirror/repos","events_url":"https://api.github.com/users/openradar-mirror/events{/privacy}","received_events_url":"https://api.github.com/users/openradar-mirror/received_events","type":"User","site_admin":false},"open_issues":359,"closed_issues":0,"state":"open","created_at":"2015-08-03T02:08:31Z","updated_at":"2015-08-03T18:15:55Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-08-03T18:15:55Z","updated_at":"2015-08-03T18:15:55Z","closed_at":null,"body":"#### Description\n\nSummary:\r\nIBAction methods for WKInterfaceButtons take this form:\r\n\r\n@IBAction func buttonPressed() {\r\n\r\n}\r\n\r\nWithout a “sender” parameter like UIButton gives, it’s hard to reuse a method for multiple buttons; instead, you need to write one method for each button.\r\n\r\nSteps to Reproduce:\r\n1. Create a WKInterfaceController in a storyboard for your WatchKit extension, with an accompanying WKInterfaceController subclass.\r\n2. Add a WKInterfaceButton to the interface controller.\r\n3. Control-drag from the button to the WKInterfaceController subclass’ code in the Assistant Editor.\r\n4. Select “Action” from the pop-up.\r\n\r\nExpected Results:\r\nYou can provide a “sender” parameter.\r\n\r\nActual Results:\r\nYou cannot provide a “sender” parameter.\r\n\r\nVersion:\r\nXcode 6.2 Beta 3\r\n\r\nNotes:\r\nConsider an interface controller with three buttons: A, B, and C. Each button has its own property, so right now you have to write this:\r\n\r\n@IBAction func buttonAPressed() {\r\n\tbuttonPressed(buttonA)\r\n}\r\n\r\n@IBAction func buttonBPressed() {\r\n\tbuttonPressed(buttonB)\r\n}\r\n\r\n@IBAction func buttonCPressed() {\r\n\tbuttonPressed(buttonC)\r\n}\r\n\r\nfunc buttonPressed(button: WKInterfaceButton) {\r\n\tif button == buttonA {\r\n\t\t// do something\r\n\t}\r\n\telse if button == buttonB {\r\n\t\t// do something\r\n\t}\r\n\telse if button == buttonC {\r\n\t\t// do something\r\n\t}\r\n}\r\n\r\nIf we were able to send a “sender” parameter, we could do with just the last function in that code, linking it to each WKInterfaceButton.\n\n-\nProduct Version: Xcode 6.2 Beta 3\nCreated: 2015-01-08T19:52:19.587670\nOriginated: 2015-01-08T00:00:00\nOpen Radar Link: http://www.openradar.me/19415424"}}