目录
目录README.md

SafariView

SafariView is a small Swift package for iOS that adds a SwiftUI bridge to SafariViewController.

Getting Started

SafariView can be easily installed through the Swift Package Manager in any Xcode project. To add SafariView to your package in Xcode 13, go to File › Swift Packages › Add Package Dependency… and paste in the URL: https://github.com/alicerunsonfedora/SafariView.

Example Usage

This example demonstrates how to open a SafariView when the user taps a button on iOS:

import SafariView
import SwiftUI

struct ExampleView: View {
    
    @State private var destination: URL = .init(string: "https://www.apple.com")
    @State private var showSafari: Bool = false

    var body: some View {
        VStack {
            Button {
                showSafari.toggle()
            } label: {
                Text("Go to Apple.com!")
            }
        }
        .sheet(isPresented: $showSafari) {
            SafariView(url: $destination)
                .collapsible(.constant(true))
        }
    }
}
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号