Skip to content

Instantly share code, notes, and snippets.

@ivangodfather
Created October 13, 2020 16:02
Show Gist options
  • Save ivangodfather/8a95b37bd4944bb901df763b7bd1dc69 to your computer and use it in GitHub Desktop.
Save ivangodfather/8a95b37bd4944bb901df763b7bd1dc69 to your computer and use it in GitHub Desktop.
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