From c19ec27a225442813e68906e6780f02f59355022 Mon Sep 17 00:00:00 2001 From: Dongkyu Kim Date: Sat, 12 Sep 2020 12:04:07 +0900 Subject: [PATCH 1/3] Fix an issue where the presenter does not hold a new presenter struct --- .../BetterSafariView/SafariView/SafariViewPresenter.swift | 5 ++++- .../WebAuthenticationPresenter.swift | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Sources/BetterSafariView/SafariView/SafariViewPresenter.swift b/Sources/BetterSafariView/SafariView/SafariViewPresenter.swift index 0dda799..48e91cb 100644 --- a/Sources/BetterSafariView/SafariView/SafariViewPresenter.swift +++ b/Sources/BetterSafariView/SafariView/SafariViewPresenter.swift @@ -20,6 +20,9 @@ struct SafariViewPresenter: UIViewControllerRepresentable { } func updateUIViewController(_ uiViewController: UIViewController, context: Context) { + + // Keep the coordinator updated with a new presenter struct. + context.coordinator.parent = self context.coordinator.item = item } } @@ -30,7 +33,7 @@ extension SafariViewPresenter { // MARK: Parent Copying - private var parent: SafariViewPresenter + var parent: SafariViewPresenter init(parent: SafariViewPresenter) { self.parent = parent diff --git a/Sources/BetterSafariView/WebAuthenticationSession/WebAuthenticationPresenter.swift b/Sources/BetterSafariView/WebAuthenticationSession/WebAuthenticationPresenter.swift index 31c8a1f..277eeb2 100644 --- a/Sources/BetterSafariView/WebAuthenticationSession/WebAuthenticationPresenter.swift +++ b/Sources/BetterSafariView/WebAuthenticationSession/WebAuthenticationPresenter.swift @@ -26,6 +26,8 @@ struct WebAuthenticationPresenter: UIViewControllerRepresent // INFO: `SFAuthenticationViewController` is a private subclass of `SFSafariViewController`. context.coordinator.setInteractiveDismissalDelegateIfPossible() + // Keep the coordinator updated with a new presenter struct. + context.coordinator.parent = self context.coordinator.item = item } } @@ -36,7 +38,7 @@ extension WebAuthenticationPresenter { // MARK: Parent Copying - private var parent: WebAuthenticationPresenter + var parent: WebAuthenticationPresenter init(parent: WebAuthenticationPresenter) { self.parent = parent From 468c4ff1d19e1d54cd19e583bbeda3d06d12f11d Mon Sep 17 00:00:00 2001 From: Dongkyu Kim Date: Sat, 19 Sep 2020 08:45:53 +0900 Subject: [PATCH 2/3] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c6aa60..82dce74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [v2.2.2](https://github.com/stleamist/BetterSafariView/releases/tag/v2.2.2) (2020-09-19) +### Fixed +- Fixed an issue where the changes of `SafariView` and `WebAuthenticationSession` is not applied after an initialization. + ## [v2.2.1](https://github.com/stleamist/BetterSafariView/releases/tag/v2.2.1) (2020-08-26) ### Fixed - Fixed an issue where the package could not be compiled on Swift 5.2 or earlier. From 3c3e54c5db8a6a5f61212c17d5fd375ee48f4537 Mon Sep 17 00:00:00 2001 From: Dongkyu Kim Date: Sat, 19 Sep 2020 08:46:16 +0900 Subject: [PATCH 3/3] Update README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fd3c692..dd5899e 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ struct ContentView: View { Add the following line to the `dependencies` in your [`Package.swift`](https://developer.apple.com/documentation/swift_packages/package) file: ```swift -.package(url: "https://github.com/stleamist/BetterSafariView.git", .upToNextMajor(from: "2.2.1")) +.package(url: "https://github.com/stleamist/BetterSafariView.git", .upToNextMajor(from: "2.2.2")) ``` Next, add `BetterSafariView` as a dependency for your targets: @@ -170,7 +170,7 @@ import PackageDescription let package = Package( name: "MyPackage", dependencies: [ - .package(url: "https://github.com/stleamist/BetterSafariView.git", .upToNextMajor(from: "2.2.1")) + .package(url: "https://github.com/stleamist/BetterSafariView.git", .upToNextMajor(from: "2.2.2")) ], targets: [ .target(name: "MyTarget", dependencies: ["BetterSafariView"])