gemenon

[ACTIVE] The Safari of the Gemini ecosystem
git clone git://git.figbert.com/gemenon.git
Log | Files | Refs

commit e4cfbdc8ac94fa08e6a3673862d6ad58d2980ff1
parent 42f4e06cb420895c6b3e8040955e1beb94164bb2
Author: FIGBERT <figbert@figbert.com>
Date:   Sat,  3 Sep 2022 12:44:43 -0700

Add basic Safari-like URL bar UI

Diffstat:
MShared/ContentView.swift | 25+++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/Shared/ContentView.swift b/Shared/ContentView.swift @@ -8,12 +8,33 @@ import SwiftUI struct ContentView: View { + @State private var url = URLBar() + @State private var columnVisibility = NavigationSplitViewVisibility.detailOnly + var body: some View { - Text("Hello, world!") - .padding() + NavigationSplitView(columnVisibility: $columnVisibility) { + Text("bookmarks") + } detail: { + Text(url.url?.absoluteString ?? "") + } + .toolbar { + ToolbarItem(placement: .principal) { + TextField("Search or enter website name", text: $url.bar) + .textFieldStyle(.roundedBorder) + .autocorrectionDisabled(true) + .onSubmit { + url.url = URL(string: url.bar) + } + } + } } } +struct URLBar { + var bar = "" + var url: URL? = nil +} + struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView()