{"id":13484529,"url":"https://github.com/kylehickinson/SwiftUI-WebView","last_synced_at":"2025-03-27T16:30:55.916Z","repository":{"id":63916268,"uuid":"194726890","full_name":"kylehickinson/SwiftUI-WebView","owner":"kylehickinson","description":"A SwiftUI component to use WKWebView","archived":false,"fork":false,"pushed_at":"2024-12-31T15:16:43.000Z","size":16,"stargazers_count":352,"open_issues_count":1,"forks_count":48,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-25T15:18:23.677Z","etag":null,"topics":["swiftui","webview","wkwebview"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kylehickinson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-01T18:49:21.000Z","updated_at":"2025-03-15T16:21:03.000Z","dependencies_parsed_at":"2025-01-20T04:25:29.264Z","dependency_job_id":"9fd3dbc6-3d44-4fb0-ba53-6e9ec74604e4","html_url":"https://github.com/kylehickinson/SwiftUI-WebView","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":"0.36363636363636365","last_synced_commit":"b733415f0c73f88ef7fc2c02a38362f41936818c"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylehickinson%2FSwiftUI-WebView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylehickinson%2FSwiftUI-WebView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylehickinson%2FSwiftUI-WebView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylehickinson%2FSwiftUI-WebView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kylehickinson","download_url":"https://codeload.github.com/kylehickinson/SwiftUI-WebView/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245486358,"owners_count":20623244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["swiftui","webview","wkwebview"],"created_at":"2024-07-31T17:01:25.693Z","updated_at":"2025-03-27T16:30:55.886Z","avatar_url":"https://github.com/kylehickinson.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# WebView\n\nA SwiftUI component `View` that contains a `WKWebView` \n\nSince `WKWebView` handles a lot of its own state, navigation stack, etc, it's almost easier to treat it as a mutable data model. You can set it up prior to how you need it, and then simply use its data within your SwiftUI View's.\n\nSimply spin up a `WebViewStore` (optionally with your own `WKWebView`) and use that to access the `WKWebView` itself as if it was a data model.\n\nExample usage:\n\n```swift\nimport SwiftUI\nimport WebView\n\nstruct ContentView: View {\n  @StateObject var webViewStore = WebViewStore()\n  \n  var body: some View {\n    NavigationView {\n      WebView(webView: webViewStore.webView)\n        .navigationBarTitle(Text(verbatim: webViewStore.title ?? \"\"), displayMode: .inline)\n        .navigationBarItems(trailing: HStack {\n          Button(action: goBack) {\n            Image(systemName: \"chevron.left\")\n              .imageScale(.large)\n              .aspectRatio(contentMode: .fit)\n              .frame(width: 32, height: 32)\n          }.disabled(!webViewStore.canGoBack)\n          Button(action: goForward) {\n            Image(systemName: \"chevron.right\")\n              .imageScale(.large)\n              .aspectRatio(contentMode: .fit)\n              .frame(width: 32, height: 32)\n          }.disabled(!webViewStore.canGoForward)\n        })\n    }.onAppear {\n      self.webViewStore.webView.load(URLRequest(url: URL(string: \"https://apple.com\")!))\n    }\n  }\n  \n  func goBack() {\n    webViewStore.webView.goBack()\n  }\n  \n  func goForward() {\n    webViewStore.webView.goForward()\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkylehickinson%2FSwiftUI-WebView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkylehickinson%2FSwiftUI-WebView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkylehickinson%2FSwiftUI-WebView/lists"}