-
-
Save sturdysturge/54afb8b2343b7210fd1ebfad2f4b7098 to your computer and use it in GitHub Desktop.
This file contains 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 | |
struct ContentView: View { | |
@State var number = 0 | |
@State var text = "" | |
@State var viewHasAppeared = false | |
func printRefresh() { | |
if viewHasAppeared { | |
print("View was refreshed with number '\(number)' and text '\(text)'") | |
} else { | |
print("View appeared with number '\(number)' and text '\(text)'") | |
} | |
} | |
var body: some View { | |
Form { | |
let _ = printRefresh() | |
Stepper("Number", value: $number) | |
TextField("", text: $text) | |
} | |
.onAppear { viewHasAppeared = true } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment