Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- import SwiftUI
- struct Details : View {
- var body: some View {
- Text("Details").onAppear {
- print("Appeared")
- }.onDisappear {
- print("Disappear")
- }
- }
- }
- struct ContentView : View {
- var body: some View {
- NavigationButton(destination: Details()) {
- Text("Push details")
- }
- }
- }
- class SceneDelegate: UIResponder, UIWindowSceneDelegate {
- var window: UIWindow?
- func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
- let window = UIWindow(frame: UIScreen.main.bounds)
- let root = UIHostingController(rootView: ContentView())
- window.rootViewController = UINavigationController(rootViewController: root)
- self.window = window
- window.makeKeyAndVisible()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement