Created
October 13, 2020 16:02
-
-
Save ivangodfather/8a95b37bd4944bb901df763b7bd1dc69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import CoreData | |
struct RandomView: View { | |
var body: some View { | |
Text("Hi") | |
.onAppear { | |
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(1)) { | |
doSomething() | |
} | |
} | |
.onDisappear(perform: { | |
print("disappear") | |
}) | |
} | |
func doSomething() { | |
print("i wanna be printed one time") | |
} | |
} | |
struct ContentView: View { | |
var body: some View { | |
TabView() { | |
RandomView() | |
Text("Other") | |
}.tabViewStyle(PageTabViewStyle()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment