Swiftpack.co - alicerunsonfedora/SafariView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by alicerunsonfedora.
alicerunsonfedora/SafariView 0.1.0
Present a Safari view controller in your iOS apps using SwiftUI on iOS 13+.
⭐️ 1
🕓 2 years ago
iOS
.package(url: "https://github.com/alicerunsonfedora/SafariView.git", from: "0.1.0")

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))
        }
    }
}

GitHub

link
Stars: 1
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

v0.1.0
2 years ago

Initial release

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics