I have two functions written in my iOS app code. I've created two buttons on watch app. On touching them, I just need to call those two functions respectively. So, is there any simple way to do so ?
watchkit help needed
You can create IBActions for your buttons from Interface Builder.
Elaborating a little on Tom's response - Open the interface builder for the Watch App project, click to select the button you want to map to a function and then press the two-circles icon to open assitant editor and drag from the desired button to the editor while holding down the control key. When you release the mouse button it will ask what type of connection you want -- select IBAction and then put your code in the created code-block section.
Here is a good example: http://rshankar.com/different-ways-to-connect-ibaction-to-uibutton/
Actually, I need to call the methods written in my iOS app code, when I touch button in the watch app. I tried using shared data - App Groups, but it's not something real time.
For example, if I have a button in iOS app, on pressing that one label gets changed. I need to do the same with a button on my watch. When I press the button on my watch it should call the same method and change the label in iPhone app. Is it possible some how ?
Fortunately, there is no way to do this with any guaranty of consistency. If the iPhone is
out of range, your watch app won't function. If the companion app on the iPhone is
not running, your watch app won't function.
Yes, I did mean to say FORTUNATELY. Because, were there an easy and reliable way
to do what you seek, it would lead to a lot of co-dependant apps that break simply because
one device is not currently available. You should instead design your Watch app to be as
independant of the iPhone as possible. Transfer data on lauch or via messages with WCSession
but never expect both to be available all the time.