Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split into multiple packages. #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@ let package = Package(
name: "BetterSafariView",
platforms: [.iOS(.v13), .macOS(.v10_15), .watchOS("6.2")],
products: [
.library(name: "BetterSafariView", targets: ["BetterSafariView"])
.library(name: "BetterSafariView",
targets: ["BetterSafariView"]),
.library(name: "SafariView",
targets: ["SafariView"]),
.library(name: "WebAuthenticationSession",
targets: ["WebAuthenticationSession"])
],
targets: [
.target(name: "BetterSafariView")
.target(name: "BetterSafariView",
dependencies: ["SafariView", "WebAuthenticationSession"]),
.target(name: "SafariView",
dependencies: ["Shared"]),
.target(name: "WebAuthenticationSession",
dependencies: ["Shared"]),
.target(name: "Shared")
]
)
2 changes: 2 additions & 0 deletions Sources/BetterSafariView/BetterSafariView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@_exported import SafariView
@_exported import WebAuthenticationSession
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#if os(iOS)

import SwiftUI
import Shared

struct SafariViewPresentationModifier: ViewModifier {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import SwiftUI
import SafariServices
@_spi(Private) import Shared

struct SafariViewPresenter<Item: Identifiable>: UIViewRepresentable {

Expand Down Expand Up @@ -85,7 +86,7 @@ extension SafariViewPresenter {
// when the `UIViewControllerRepresentable` is detached from the root view controller (e.g. `UIViewController` contained in `UITableViewCell`)
// while allowing it to be presented even on the modal sheets.
// Thanks to: Bohdan Hernandez Navia (@boherna)
guard let presentingViewController = uiView.viewController else {
guard let presentingViewController = uiView._viewController else {
self.resetItemBinding()
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

import UIKit

@_spi(Private)
extension UIView {

/// The receiver’s view controller, or `nil` if it has none.
///
/// This property is `nil` if the view has not yet been added to a view controller.
var viewController: UIViewController? {
public var _viewController: UIViewController? {
if let nextResponder = self.next as? UIViewController {
return nextResponder
} else if let nextResponder = self.next as? UIView {
return nextResponder.viewController
return nextResponder._viewController
} else {
return nil
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#if os(iOS) || os(macOS) || os(watchOS)

import SwiftUI
import Shared

struct WebAuthenticationPresentationModifier: ViewModifier {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import SwiftUI
import AuthenticationServices
@_spi(Private) import Shared

#if os(iOS)
import SafariServices
#endif
Expand Down Expand Up @@ -199,7 +201,7 @@ extension WebAuthenticationPresenter {

@available(iOS, introduced: 13.0, deprecated: 14.0)
func setInteractiveDismissalDelegateIfPossible() {
guard let safariViewController = view.viewController?.presentedViewController as? SFSafariViewController else {
guard let safariViewController = view._viewController?.presentedViewController as? SFSafariViewController else {
return
}
safariViewController.presentationController?.delegate = interactiveDismissalDelegate
Expand Down