Skip to content

Commit 1c76a65

Browse files
authored
Merge pull request #552 from Esri/Caleb/Fix-BrowseOGCAPIFeatureServiceBug
[Fix] `Browse OGC API feature service` alert bug
2 parents e90c33e + 8da2470 commit 1c76a65

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Shared/Samples/Browse OGC API feature service/BrowseOGCAPIFeatureServiceView.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ struct BrowseOGCAPIFeatureServiceView: View {
1919
/// The error shown in the error alert.
2020
@State private var error: Error?
2121

22-
/// A Boolean value indicating whether the textfield alert should be presented.
23-
@State private var textfieldAlertIsPresented = true
22+
/// A Boolean value indicating whether the text field alert should be presented.
23+
@State private var textFieldAlertIsPresented = false
2424

2525
/// The data model for the sample.
2626
@StateObject private var model = Model()
@@ -37,7 +37,7 @@ struct BrowseOGCAPIFeatureServiceView: View {
3737
.toolbar {
3838
ToolbarItemGroup(placement: .bottomBar) {
3939
Button("Open Service") {
40-
textfieldAlertIsPresented = true
40+
textFieldAlertIsPresented = true
4141
}
4242

4343
Spacer()
@@ -63,8 +63,8 @@ struct BrowseOGCAPIFeatureServiceView: View {
6363
}
6464
}
6565
}
66-
.alert("Load OGC API feature service", isPresented: $textfieldAlertIsPresented) {
67-
// Textfield has a default OGC API URL.
66+
.alert("Load OGC API feature service", isPresented: $textFieldAlertIsPresented) {
67+
// Text field has a default OGC API URL.
6868
TextField("URL", text: $userInput)
6969
.keyboardType(.URL)
7070
.textContentType(.URL)
@@ -86,12 +86,15 @@ struct BrowseOGCAPIFeatureServiceView: View {
8686
}
8787
.disabled(userInput.isEmpty)
8888
Button("Cancel", role: .cancel) {
89-
// Reset the default value of the textfield.
89+
// Reset the default value of the text field.
9090
userInput = URL.daraaService.absoluteString
9191
}
9292
} message: {
9393
Text("Please provide a URL to an OGC API feature service.")
9494
}
95+
.onAppear {
96+
textFieldAlertIsPresented = true
97+
}
9598
.errorAlert(presentingError: $error)
9699
}
97100
}

0 commit comments

Comments
 (0)