UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

How to open a specific view when opening a notification?

Forums > SwiftUI

In my app the user can schedule notifications. But when the user opens a notification it opens the homeView. But i want the app to open a specific relevant view, that shows the right coreData entity/data. How to do that?

2      

@Bnerd  

Idea:

  • Have a boolean that controls the navigation to the View you want.
  • Have an actionable notification with just an "Ok" button that will toggle that boolean

I didn't try it..

2      

That a very simple question, however the answer is a bit longer. If you watch Stewart Lynch Video on Notifcations and make sure look at the second one Swift Local Notifications 4: Responding to Notifications. You probably find the answer there.

2      

@NigelGee this explains exactly how to do it for just text, but now for a view that you give a coreData object

2      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.