WebViewKit is a Swift SDK that adds a WebView
and a SafariWebView
to SwiftUI
.
The web view can be used to display web sites in your apps, for instance like this:
The WebView
can load any url and be configured to fit your needs. There's also a SafariWebView
for more basic needs.
WebViewKit can be installed with the Swift Package Manager:
https://github.com/danielsaidi/WebViewKit.git
The library's main view is WebView
, which can be used to display any URL:
import SwiftUI
import WebViewKit
struct MyView {
var body: some View {
WebView(urlString: "https://danielsaidi.com")
}
}
The URL can point to any regular web site, but also to local web pages in your app bundle. There's also an iOS only SafariWebView
, which has less configuration support and standard toolbars surrounding the web browser.
For more information, please see the getting started guide.
The online documentation has more information, articles, code examples, etc.
The demo app lets you explore the library. To try it out, just open and run the Demo
project.
You can sponsor me on GitHub Sponsors or reach out for paid support, to help support my open-source projects.
Your support makes it possible for me to put more work into these projects and make them the best they can be.
Feel free to reach out if you have questions or if you want to contribute in any way:
- Website: danielsaidi.com
- Mastodon: @danielsaidi@mastodon.social
- Twitter: @danielsaidi
- E-mail: daniel.saidi@gmail.com
WebViewKit is available under the MIT license. See the LICENSE file for more info.