From acec5b5710b64131fc424c83409ad247ad41be47 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Tue, 19 Dec 2023 13:31:02 -0700 Subject: add dismiss button --- .../Assets.xcassets/AppIcon.appiconset/Contents.json | 2 ++ .../AppIcon.appiconset/iGopherBrowserLogo-2 1.png | Bin 0 -> 81570 bytes .../AppIcon.appiconset/iGopherBrowserLogo-2.png | Bin 0 -> 81570 bytes iGopherBrowser/FileView.swift | 2 -- iGopherBrowser/SearchInputView.swift | 16 +++++++++++++--- 5 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 iGopherBrowser/Assets.xcassets/AppIcon.appiconset/iGopherBrowserLogo-2 1.png create mode 100644 iGopherBrowser/Assets.xcassets/AppIcon.appiconset/iGopherBrowserLogo-2.png diff --git a/iGopherBrowser/Assets.xcassets/AppIcon.appiconset/Contents.json b/iGopherBrowser/Assets.xcassets/AppIcon.appiconset/Contents.json index 532cd72..1110c85 100644 --- a/iGopherBrowser/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/iGopherBrowser/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,6 +1,7 @@ { "images" : [ { + "filename" : "iGopherBrowserLogo-2 1.png", "idiom" : "universal", "platform" : "ios", "size" : "1024x1024" @@ -51,6 +52,7 @@ "size" : "512x512" }, { + "filename" : "iGopherBrowserLogo-2.png", "idiom" : "mac", "scale" : "2x", "size" : "512x512" diff --git a/iGopherBrowser/Assets.xcassets/AppIcon.appiconset/iGopherBrowserLogo-2 1.png b/iGopherBrowser/Assets.xcassets/AppIcon.appiconset/iGopherBrowserLogo-2 1.png new file mode 100644 index 0000000..a3e0c2e Binary files /dev/null and b/iGopherBrowser/Assets.xcassets/AppIcon.appiconset/iGopherBrowserLogo-2 1.png differ diff --git a/iGopherBrowser/Assets.xcassets/AppIcon.appiconset/iGopherBrowserLogo-2.png b/iGopherBrowser/Assets.xcassets/AppIcon.appiconset/iGopherBrowserLogo-2.png new file mode 100644 index 0000000..a3e0c2e Binary files /dev/null and b/iGopherBrowser/Assets.xcassets/AppIcon.appiconset/iGopherBrowserLogo-2.png differ diff --git a/iGopherBrowser/FileView.swift b/iGopherBrowser/FileView.swift index 2d96526..c4080e4 100644 --- a/iGopherBrowser/FileView.swift +++ b/iGopherBrowser/FileView.swift @@ -79,10 +79,8 @@ struct FileView: View { } private func readFile(_ item: gopherItem) { - // Execute the network request on a background thread self.client.sendRequest(to: item.host, port: item.port, message: "\(item.selector)\r\n") { result in // Dispatch the result handling back to the main thread - switch result { case .success(let resp): if item.parsedItemType == .text { diff --git a/iGopherBrowser/SearchInputView.swift b/iGopherBrowser/SearchInputView.swift index cae88f3..3780f95 100644 --- a/iGopherBrowser/SearchInputView.swift +++ b/iGopherBrowser/SearchInputView.swift @@ -15,16 +15,26 @@ struct SearchInputView: View { @Binding var searchText: String var onSearch: (String) -> Void + @Environment(\.presentationMode) var presentationMode + var body: some View { VStack { Text("Enter your query") TextField("Search", text: $searchText) .textFieldStyle(RoundedBorderTextFieldStyle()) .padding() - Button("Search") { - onSearch(searchText) + HStack { + + Button("Cancel") { + presentationMode.wrappedValue.dismiss() + } + .padding() + + Button("Search") { + onSearch(searchText) + } + .padding() } - .padding() } .padding() } -- cgit v1.2.3