Refresh/Reload Views on watchOS with SwiftUI

I have an iOS app with a companion watchOS app.

On the main app I set up an auto renewing subscription. By purchasing it you unlock the Apple Watch app. If you are not subscribed, a paywall view is shown in the watch app. If you are, you get to see the whole app.

The thing is when a user completes the purchase on the main app, the watchOS view won't update.

The Watch Connectivity framework is set up just fine and I get to communicate successfully to/from both devices. But to reflect the new state change, from the purchase made on the phone, I need to close the watch app and open it again. In doing so, the home page opens up and the users will finally get to navigate the app.

Is there a way so that upon receiving the message from the Connectivity framework, I get to refresh/reload the view so that the user doesn't have to close the app and open it again?

The pseudocode would be:

  • I receive the object from the main app
  • I check that the user has successfully purchased the subscription
  • I reload the app/reload the view so that the user after tapping the app on the watch gets to see the home page with no extra steps.

Thank you!

Refresh/Reload Views on watchOS with SwiftUI
 
 
Q