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
struct ThirdPartyDemoView: View { | |
@State private var shouldAdd = true | |
@State private var currentValue = 0 | |
var body: some View { | |
ThirdPartyReader { proxy in | |
Text("\(currentValue)") | |
ThirdPartyView(shouldAdd: shouldAdd) | |
.viewChangedValueTo { view, newValue in | |
currentValue = newValue |
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
struct ContentView: View { | |
var body: some View { | |
NavigationView { | |
List { | |
NavigationLink(destination: Text("Top Level")) { | |
Text("Top Level Link") | |
} | |
NavigationLink(destination: detailView) { | |
Text("Show Sub Links") |
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
struct NameDisplayView: View { | |
@State var name: String = "unknown" | |
@State var showNameChange = false | |
var body: some View { | |
VStack { | |
Text("Your name is \(name)") | |
Divider() | |
Button("Change") { | |
self.showNameChange = true |
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
@propertyWrapper | |
/// Wrapper used to easily encode a `Date` to and decode a `Date` from an ISO 8601 formatted date string. | |
struct ISO8601Date: Codable { | |
var wrappedValue: Date | |
init(wrappedValue: Date) { | |
self.wrappedValue = wrappedValue | |
} | |
init(from decoder: Decoder) throws { |