Skip to content

Commit

Permalink
Merge pull request #41 from Tunous/fix/iOS-17-show-with-keyboard
Browse files Browse the repository at this point in the history
[iOS 17] Fix navigation to safari not working when keyboard is visible
  • Loading branch information
stleamist authored Oct 29, 2023
2 parents dffd42b + cfa7f03 commit 9f997fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions Demo/iOS/Views/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ struct RootView: View {
@State private var showingWebAuthenticationSessionOptionsForm = false

@State private var webAuthenticationSessionCallbackURL: URL? = nil


@State private var text = ""

var body: some View {
NavigationView {
List {
Expand Down Expand Up @@ -73,7 +75,9 @@ struct RootView: View {
WebAuthenticationSessionOptionsForm(options: $webAuthenticationSessionOptions)
}
}


TextField("Text field", text: $text)

Section(header: Text("NaiveSafariView" + "\n" + "(Just for comparison. Do not use in practice.)").textCase(nil)) {
Button(action: { showingNaiveSafariViewSheet = true }) {
HStack {
Expand Down
6 changes: 3 additions & 3 deletions Sources/BetterSafariView/Shared/UIView+viewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import UIKit

extension UIView {
extension UIResponder {

/// 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? {
if let nextResponder = self.next as? UIViewController {
return nextResponder
} else if let nextResponder = self.next as? UIView {
} else if let nextResponder = self.next {
return nextResponder.viewController
} else {
return nil
Expand Down

0 comments on commit 9f997fb

Please sign in to comment.