Advertisement
mpokhylets

Untitled

Jun 17th, 2019
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.88 KB | None | 0 0
  1. import UIKit
  2. import SwiftUI
  3.  
  4. struct Details : View {
  5.     var body: some View {
  6.         Text("Details").onAppear {
  7.             print("Appeared")
  8.         }.onDisappear {
  9.             print("Disappear")
  10.         }
  11.     }
  12. }
  13.  
  14. struct ContentView : View {
  15.     var body: some View {
  16.         NavigationButton(destination: Details()) {
  17.             Text("Push details")
  18.         }
  19.     }
  20. }
  21.  
  22. class SceneDelegate: UIResponder, UIWindowSceneDelegate {
  23.  
  24.     var window: UIWindow?
  25.     func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
  26.         let window = UIWindow(frame: UIScreen.main.bounds)
  27.         let root = UIHostingController(rootView: ContentView())
  28.         window.rootViewController = UINavigationController(rootViewController: root)
  29.         self.window = window
  30.         window.makeKeyAndVisible()
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement