Giter Club home page Giter Club logo

webviewkit's Introduction

WebViewKit Logo

Version Swift 5.6 Swift UI MIT License Twitter: @danielsaidi Mastodon: @danielsaidi@mastodon.social

About WebViewKit

WebViewKit adds a WebView to SwiftUI, 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 a SafariWebView as well.

WebViewKit supports iOS 13 and macOS 11.

Installation

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.

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 display web pages and HTML content.

The easiest way to use this view is to just load a url into it:

import SwiftUI
import WebViewKit

struct MyView {

    var body: some View {
        WebView(urlString: "https://danielsaidi.com")
    }
}

The URL can point to any global URL, as above, but also to files in any bundle:

let localUrl = Bundle.main.url(forResource: "about", withExtension: "html")
let view = WebView(url: localUrl)

You can load a custom HTML string into the web view, provide custom configurations, etc.

The library also contains an iOS only SafariWebView, which can load the same kind of content as the WebView. It's basic compared to WebView, 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.

webviewkit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

webviewkit's Issues

loading html string

I couldn't find a way to load html string in the webview, is there any workaround for that ?

How do you load local pages?

The documentation says "which can be used to load local and online web pages."

Does local web pages mean:

  • pointing to web server running locally
  • pointing to files on the local filesystem
  • using the app to supply content to the web view

Please consider adding clarification and examples.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.