Post

Replies

Boosts

Views

Activity

Reply to SwiftUI - Show alert when go to new page
I was solve with this code changes struct SecondView: View { @State var showAlert = false var body: some View { // i want to show alert when navigate to this view VStack{ Text("Second View") .alert(isPresented: $showAlert) { Alert(title: Text("You are in second view")) } }.onAppear{ showAlert = true } } } thanks all
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to SwiftUI - Show alert when go to new page
ContentView.swift struct ContentView: View { var body: some View { VStack{ NavigationLink(destination: SecondView()){ Text("Go to second view") } } } } SecondView.swift struct SecondView: View { @State var showAlert = true var body: some View { // i want to show alert when navigate to this view VStack{ Text("Second View") .alert(isPresented: $showAlert) { Alert(title: Text("You are in second view")) } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to Developer
A Great site for learning Swift, SwiftUI and UIKit is HackingWithSwift.com So lot of free courses for learn how to build app for Apple Platforms
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to SwiftUI - Show alert when go to new page
I was solve with this code changes struct SecondView: View { @State var showAlert = false var body: some View { // i want to show alert when navigate to this view VStack{ Text("Second View") .alert(isPresented: $showAlert) { Alert(title: Text("You are in second view")) } }.onAppear{ showAlert = true } } } thanks all
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to SwiftUI - Show alert when go to new page
ContentView.swift struct ContentView: View { var body: some View { VStack{ NavigationLink(destination: SecondView()){ Text("Go to second view") } } } } SecondView.swift struct SecondView: View { @State var showAlert = true var body: some View { // i want to show alert when navigate to this view VStack{ Text("Second View") .alert(isPresented: $showAlert) { Alert(title: Text("You are in second view")) } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’21