Sunday, February 15, 2026
HomeiOS Developmentswift - Use a button on iOS app to set off perform...

swift – Use a button on iOS app to set off perform on WatchOS

[ad_1]

I’ve an iOS and watchOS app that collects knowledge from the Apple Watch sensors, proper now to begin gathering that knowledge I’ve a button on the watchOS app:

Button(motion: {
                self.logStart.toggle()
                
                if self.logStart {
                    self.sensorLog.startUpdate(60.0)
                }
                else {
                    self.sensorLog.stopUpdate()
                    
                }
            }) {
                if self.logStart {
                    Picture(systemName: "pause.circle")
                    Textual content("Cease")
                }
                else {
                    Picture(systemName: "play.circle")
                    Textual content(“Begin”)
                }
            }

I wish to replicate that button on the iOS app so I can begin the info assortment course of by urgent the “begin” button on the iPhone or the Apple Watch.
I do know that I would like to make use of WatchConnectivity to work together between the iOS and watchOS app, however I’m new to watchOS and I’m having a very onerous time implementing this.
Any recommendation will likely be actually appreciated.
Thanks!

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments