Skip to content

Latest commit

 

History

History
83 lines (66 loc) · 2.41 KB

README.md

File metadata and controls

83 lines (66 loc) · 2.41 KB

WebUI

WebUI is a Swift package that provides WKWebView wrapped by SwiftUI.

Github issues Github forks Github stars Top language Release Github license

Requirements

  • Development with Xcode 15.1+
  • Written in Swift 5.9
  • Compatible with iOS 16.4+
  • Compatible with macOS 13.3+

Documentation

Latest (Swift DocC)

Privacy Manifest

This library does not collect or track user information, so it does not include a PrivacyInfo.xcprivacy file.

Installation

WebUI is available through Swift Package Manager.

Xcode

  1. File > Add Package Dependencies…
  2. Search https://github.com/cybozu/WebUI.git.
  3. Add package and link WebUI to your application target.

CLI

  1. Create Package.swift that describes dependencies.
    // swift-tools-version: 5.9
    import PackageDescription
    
    let package = Package(
        name: "SomeProduct",
        products: [
            .library(name: "SomeProduct", targets: ["SomeProduct"])
        ],
        dependencies: [
            .package(url: "https://github.com/cybozu/WebUI.git", exact: "2.0.0")
        ],
        targets: [
            .target(
                name: "SomeProduct",
                dependencies: [
                    .product(name: "WebUI", package: "WebUI")
                ]
            )
        ]
    )
  2. Run the following command in Terminal.
    $ swift package resolve

Usage

struct ContentView: View {
    var body: some View {
        WebViewReader { proxy in
            WebView()
                .onAppear {
                    proxy.load(url: URL(string: "https://www.example.com")!)
                }
        }
        .padding()
    }
}