diff --git a/CHANGELOG.md b/CHANGELOG.md index 500d28d..2c6aa60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [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. + ## [v2.2.0](https://github.com/stleamist/BetterSafariView/releases/tag/v2.2.0) (2020-08-26) ### Added - `SafariView` now conforms to `View` protocol, so it can be used even in the `.sheet()` or the `.fullScreenCover()` modifiers for the advanced usage. diff --git a/README.md b/README.md index dd51819..1328e0a 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.0")) +.package(url: "https://github.com/stleamist/BetterSafariView.git", .upToNextMajor(from: "2.2.1")) ``` 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.0")) + .package(url: "https://github.com/stleamist/BetterSafariView.git", .upToNextMajor(from: "2.2.1")) ], targets: [ .target(name: "MyTarget", dependencies: ["BetterSafariView"]) diff --git a/Sources/BetterSafariView/SafariView/SafariView+View.swift b/Sources/BetterSafariView/SafariView/SafariView+View.swift index 5fceac2..747b8eb 100644 --- a/Sources/BetterSafariView/SafariView/SafariView+View.swift +++ b/Sources/BetterSafariView/SafariView/SafariView+View.swift @@ -4,6 +4,8 @@ import SafariServices // A `View` conformance for the advanced usage. extension SafariView: View { + #if compiler(>=5.3) + // To apply `ignoresSafeArea(_:edges:)` modifier to the `UIViewRepresentable`, // define nested `Representable` struct and wrap it with `View`. public var body: some View { @@ -31,6 +33,17 @@ extension SafariView: View { public func accentColor(_ accentColor: Color?) -> Self { return self.preferredControlAccentColor(accentColor) } + + #else + + // To apply `ignoresSafeArea(_:edges:)` modifier to the `UIViewRepresentable`, + // define nested `Representable` struct and wrap it with `View`. + public var body: some View { + Representable(parent: self) + .edgesIgnoringSafeArea(.all) + } + + #endif } extension SafariView {