Update fastfile
WebViewKit adds a WebView to SwiftUI, that can be used to display web sites in your app.
WebView
SwiftUI
The result can look like this and can also be presented in sheets, full screen covers etc.:
The WebView view can load any url and be fully configured to fit your needs. For more basic needs, you have a SafariWebView as well.
SafariWebView
WebViewKit supports iOS 13 and macOS 11.
iOS 13
macOS 11
WebViewKit can be installed with the Swift Package Manager:
https://github.com/danielsaidi/WebViewKit.git
If you prefer to not have external dependencies, you can also just copy the source code into your app.
The online documentation has a getting started guide guide to help you get started with WebViewKit.
The library’s main view is WebView, which can be used to display any web page.
import SwiftUI import WebViewKit struct MyView { let url = URL(string: "https://danielsaidi.com") var body: some View { WebView(url: url) } }
The URL can point to any regular web site URLs, as above, but also to local web pages in your app bundle:
let localUrl = Bundle.main.url(forResource: "about", withExtension: "html")
The library also contains an iOS only SafariWebView, which can load the same kind of content as the WebView.
Unlike WebView, SafariWebView is pretty basic, but adds a topmost navigation bar and a bottommost toolbar with buttons for additional convenience.
For more information, please see the online documentation and getting started guide.
The online documentation contains more information, code examples, etc., and makes it easy to overview the various parts of the library.
The demo app lets you explore the library on iOS and macOS. To try it out, just open and run the Demo project.
Demo
I manage my various open-source projects in my free time and am really thankful for any help I can get from the community.
You can sponsor this project on GitHub Sponsors or get in touch for paid support.
Feel free to reach out if you have questions or if you want to contribute in any way:
WebViewKit is available under the MIT license. See the LICENSE file for more info.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
About WebViewKit
WebViewKit adds a
WebView
toSwiftUI
, that can be used to display web sites in your app.The result can look like this and can also be presented in sheets, full screen covers etc.:
The
WebView
view can load any url and be fully configured to fit your needs. For more basic needs, you have aSafariWebView
as well.WebViewKit supports
iOS 13
andmacOS 11
.Installation
WebViewKit can be installed with the Swift Package Manager:
If you prefer to not have external dependencies, you can also just copy the source code into your app.
Getting started
The online documentation has a getting started guide guide to help you get started with WebViewKit.
The library’s main view is
WebView
, which can be used to display any web page.The URL can point to any regular web site URLs, as above, but also to local web pages in your app bundle:
The library also contains an iOS only
SafariWebView
, which can load the same kind of content as theWebView
.Unlike
WebView
,SafariWebView
is pretty basic, but adds a topmost navigation bar and a bottommost toolbar with buttons for additional convenience.For more information, please see the online documentation and getting started guide.
Documentation
The online documentation contains more information, code examples, etc., and makes it easy to overview the various parts of the library.
Demo Application
The demo app lets you explore the library on iOS and macOS. To try it out, just open and run the
Demo
project.Support this library
I manage my various open-source projects in my free time and am really thankful for any help I can get from the community.
You can sponsor this project on GitHub Sponsors or get in touch for paid support.
Contact
Feel free to reach out if you have questions or if you want to contribute in any way:
License
WebViewKit is available under the MIT license. See the LICENSE file for more info.