Skip to content

Commit 685b0dd

Browse files
committed
Support visionOS 1.x
1 parent bb0d706 commit 685b0dd

18 files changed

+26
-43
lines changed

.github/workflows/xcodebuild-build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
- name: Lint
1717
run: swift package plugin --allow-writing-to-package-directory swiftformat --lint
1818
- name: Build & Test
19-
run: xcodebuild -scheme 'SafariUI' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2'
19+
run: xcodebuild -scheme 'SafariUI' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=17.4'

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ let package = Package(
77
name: "SafariUI",
88
platforms: [
99
.iOS(.v14),
10+
.visionOS(.v1),
1011
.macCatalyst(.v14)
1112
],
1213
products: [

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# SafariUI
22

33
[![MIT License](https://img.shields.io/github/license/vsanthanam/SafariUI)](https://github.com/vsanthanam/SafariUI/blob/main/LICENSE)
4-
[![Package Releases](https://img.shields.io/github/v/release/vsanthanam/SafariUI)](https://github.com/vsanthanam/SafariUI/releases)
4+
[![Release](https://img.shields.io/github/v/release/vsanthanam/SafariUI)](https://github.com/vsanthanam/SafariUI/releases)
5+
[![Pre Release](https://img.shields.io/github/v/release/vsanthanam/SafariUI?include_prereleases)](https://github.com/vsanthanam/SafariUI/releases)
56
[![Build Status](https://img.shields.io/github/actions/workflow/status/vsanthanam/SafariUI/xcodebuild-build-test.yml)](https://github.com/vsanthanam/SafariUI/actions)
67
[![Swift Version](https://img.shields.io/badge/swift-5.10-critical)](https://swift.org)
78
[![Supported Platforms](https://img.shields.io/badge/platform-iOS%2014.0%20%7C%20Catalyst%2014.0-lightgrey)](https://developer.apple.com)

Sources/SafariView/DismissButtonStyle.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import SafariServices
2727

28-
@available(iOS 14.0, macCatalyst 14.0, *)
28+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
2929
public extension SafariView {
3030

3131
/// An enumeration describing the various dismiss buttons styles available in a ``SafariView``

Sources/SafariView/Environment.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import SwiftUI
2727

28-
@available(iOS 14.0, macCatalyst 14.0, *)
28+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
2929
public extension EnvironmentValues {
3030

3131
/// The additional activies to include the share sheet displayed inside a ``SafariView``
@@ -64,7 +64,6 @@ public extension EnvironmentValues {
6464

6565
}
6666

67-
@available(iOS 14.0, macCatalyst 14.0, *)
6867
extension EnvironmentValues {
6968

7069
var safariViewEntersReaderIfAvailable: Bool {
@@ -94,7 +93,6 @@ extension EnvironmentValues {
9493

9594
}
9695

97-
@available(iOS 14.0, macCatalyst 14.0, *)
9896
private struct SafariViewEntersReaderIfAvailableEnvironmentKey: EnvironmentKey {
9997

10098
// MARK: - EnvironmentKey
@@ -105,7 +103,6 @@ private struct SafariViewEntersReaderIfAvailableEnvironmentKey: EnvironmentKey {
105103

106104
}
107105

108-
@available(iOS 14.0, macCatalyst 14.0, *)
109106
private struct SafariViewBarCollapsingEnabledEnvironmentKey: EnvironmentKey {
110107

111108
// MARK: - EnvironmentKey
@@ -116,7 +113,6 @@ private struct SafariViewBarCollapsingEnabledEnvironmentKey: EnvironmentKey {
116113

117114
}
118115

119-
@available(iOS 14.0, macCatalyst 14.0, *)
120116
private struct SafariViewControlTintColorEnvironmentKey: EnvironmentKey {
121117

122118
// MARK: - EnvironmentKey
@@ -127,7 +123,6 @@ private struct SafariViewControlTintColorEnvironmentKey: EnvironmentKey {
127123

128124
}
129125

130-
@available(iOS 14.0, macCatalyst 14.0, *)
131126
private struct SafariViewBarTintColorEnvironmentKey: EnvironmentKey {
132127

133128
// MARK: - EnvironmentKey
@@ -138,7 +133,6 @@ private struct SafariViewBarTintColorEnvironmentKey: EnvironmentKey {
138133

139134
}
140135

141-
@available(iOS 14.0, macCatalyst 14.0, *)
142136
private struct SafariViewDismissButtonStyleEnvironmentKey: EnvironmentKey {
143137

144138
// MARK: - EnvironmentKey
@@ -149,7 +143,6 @@ private struct SafariViewDismissButtonStyleEnvironmentKey: EnvironmentKey {
149143

150144
}
151145

152-
@available(iOS 14.0, macCatalyst 14.0, *)
153146
private struct SafariViewIncludedActivitiesEnvironmentKey: EnvironmentKey {
154147

155148
// MARK: - EnvironmentKey
@@ -160,7 +153,6 @@ private struct SafariViewIncludedActivitiesEnvironmentKey: EnvironmentKey {
160153

161154
}
162155

163-
@available(iOS 14.0, macCatalyst 14.0, *)
164156
private struct SafariViewExcludedActivityTypesEnvironmentKey: EnvironmentKey {
165157

166158
// MARK: - EnvironmentKey

Sources/SafariView/ExcludedActivityTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import Foundation
2727
import UIKit
2828

29-
@available(iOS 14.0, macCatalyst 14.0, *)
29+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
3030
public extension SafariView {
3131

3232
/// A struct used to exclude activity types from the share sheet of a ``SafariView``.

Sources/SafariView/IncludedActivities.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import Foundation
2727
import UIKit
2828

29-
@available(iOS 14.0, macCatalyst 14.0, *)
29+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
3030
public extension SafariView {
3131

3232
/// A struct used to include custom activities in the share sheet of a ``SafariView``

Sources/SafariView/Modifiers.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import SwiftUI
2727

28-
@available(iOS 14.0, macCatalyst 14.0, *)
28+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
2929
public extension View {
3030

3131
/// Set the automatic reader behavior of safari views within this view
@@ -224,7 +224,6 @@ public extension View {
224224

225225
}
226226

227-
@available(iOS 14.0, macCatalyst 14.0, *)
228227
private struct SafariViewEntersReaderIfAvailableModifier: ViewModifier {
229228

230229
// MARK: - Initializers
@@ -250,7 +249,6 @@ private struct SafariViewEntersReaderIfAvailableModifier: ViewModifier {
250249

251250
}
252251

253-
@available(iOS 14.0, macCatalyst 14.0, *)
254252
private struct SafariViewBarCollapsingEnabledModifier: ViewModifier {
255253

256254
// MARK: - Initializers
@@ -275,7 +273,6 @@ private struct SafariViewBarCollapsingEnabledModifier: ViewModifier {
275273
private let barCollapsingEnabled: Bool
276274
}
277275

278-
@available(iOS 14.0, macCatalyst 14.0, *)
279276
private struct SafariViewControlTintColorModifier: ViewModifier {
280277

281278
// MARK: - Initializers
@@ -301,7 +298,6 @@ private struct SafariViewControlTintColorModifier: ViewModifier {
301298

302299
}
303300

304-
@available(iOS 14.0, macCatalyst 14.0, *)
305301
private struct SafariViewBarTintColorModifier: ViewModifier {
306302

307303
// MARK: - Initializers
@@ -327,7 +323,6 @@ private struct SafariViewBarTintColorModifier: ViewModifier {
327323

328324
}
329325

330-
@available(iOS 14.0, macCatalyst 14.0, *)
331326
private struct SafariViewDismissButtonStyleModifier: ViewModifier {
332327

333328
// MARK: - Initializers
@@ -353,7 +348,6 @@ private struct SafariViewDismissButtonStyleModifier: ViewModifier {
353348

354349
}
355350

356-
@available(iOS 14.0, macCatalyst 14.0, *)
357351
private struct SafariViewIncludedActivitiesModifier: ViewModifier {
358352

359353
// MARK: - Initializers
@@ -379,7 +373,6 @@ private struct SafariViewIncludedActivitiesModifier: ViewModifier {
379373

380374
}
381375

382-
@available(iOS 14.0, macCatalyst 14.0, *)
383376
private struct SafariViewExcludedActivityTypesModifier: ViewModifier {
384377

385378
// MARK: - Initializers

Sources/SafariView/Presentation/BoolPresentation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import SafariServices
2828
import SwiftUI
2929
import UIKit
3030

31-
@available(iOS 14.0, macCatalyst 14.0, *)
31+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
3232
public extension View {
3333

3434
/// Presents a ``SafariView`` when a binding to a Boolean value that you provide is `true`.
@@ -88,7 +88,7 @@ public extension View {
8888

8989
}
9090

91-
@available(iOS 14.0, macCatalyst 14.0, *)
91+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
9292
private struct IsPresentedModifier: ViewModifier {
9393

9494
// MARK: - Initializer

Sources/SafariView/Presentation/BoolURLPresentation.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import Foundation
2727
import SwiftUI
2828

29-
@available(iOS 14.0, macCatalyst 14.0, *)
29+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
3030
public extension View {
3131

3232
/// Presents a ``SafariView`` when a binding to a Boolean value that you provide is `true`.
@@ -85,7 +85,6 @@ public extension View {
8585

8686
}
8787

88-
@available(iOS 14.0, macCatalyst 14.0, *)
8988
private struct BoolURLPresentation: ViewModifier {
9089

9190
init(

Sources/SafariView/Presentation/ItemPresentation.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import SafariServices
2828
import SwiftUI
2929
import UIKit
3030

31-
@available(iOS 14.0, macCatalyst 14.0, *)
31+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
3232
public extension View {
3333

3434
/// Presents a ``SafariView`` using the given item as a data source for the view’s content.
@@ -101,7 +101,6 @@ public extension View {
101101

102102
}
103103

104-
@available(iOS 14.0, macCatalyst 14.0, *)
105104
private struct ItemModifier<Item>: ViewModifier where Item: Identifiable {
106105

107106
// MARK: - Initializers

Sources/SafariView/Presentation/URLPresentation.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import Foundation
2727
import SwiftUI
2828

29-
@available(iOS 14.0, macCatalyst 14.0, *)
29+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
3030
public extension View {
3131

3232
/// Presents a ``SafariView`` using the given URL.
@@ -78,7 +78,6 @@ public extension View {
7878

7979
}
8080

81-
@available(iOS 14.0, macCatalyst 14.0, *)
8281
private struct URLPresentation: ViewModifier {
8382

8483
init(

Sources/SafariView/Presentation/WrappedItemPresentation.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import SwiftUI
2727

28-
@available(iOS 14.0, macCatalyst 14.0, *)
28+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
2929
public extension View {
3030

3131
/// Presents a ``SafariView`` using the given item as a data source for the view’s content.
@@ -102,7 +102,6 @@ public extension View {
102102

103103
}
104104

105-
@available(iOS 14.0, macCatalyst 14.0, *)
106105
private struct WrappedItemPresentation<Item, ID>: ViewModifier where ID: Hashable {
107106

108107
// MARK: - Initializer

Sources/SafariView/PrewarmingToken.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import SafariServices
2727

28-
@available(iOS 15.0, macCatalyst 15.0, *)
28+
@available(iOS 15.0, visionOS 1.0, macCatalyst 15.0, *)
2929
public extension SafariView {
3030

3131
/// A type created when SafariServices begins prewarming a connection.

Sources/SafariView/SafariView.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import SwiftUI
2929
import UIKit
3030

3131
/// A wrapper for `SFSafariViewController` in SwiftUI
32-
@available(iOS 14.0, macCatalyst 14.0, *)
32+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
3333
public struct SafariView: View {
3434

3535
// MARK: - Initializers
@@ -61,7 +61,7 @@ public struct SafariView: View {
6161
/// - onInitialLoad: Closure to execute on initial load
6262
/// - onInitialRedirect: Closure to execute on intial redirect
6363
/// - onOpenInBrowser: Closure to execute if a user moves from a `SafariView` to `Safari.app`
64-
@available(iOS 15.0, macCatalyst 15.0, *)
64+
@available(iOS 15.0, visionOS 1.0, macCatalyst 15.0, *)
6565
public init(
6666
url: URL,
6767
activityButton: ActivityButton?,
@@ -87,7 +87,7 @@ public struct SafariView: View {
8787
/// - onInitialLoad: Closure to execute on initial load
8888
/// - onInitialRedirect: Closure to execute on intial redirect
8989
/// - onOpenInBrowser: Closure to execute if a user moves from a `SafariView` to `Safari.app`
90-
@available(iOS 15.2, macCatalyst 15.2, *)
90+
@available(iOS 15.2, visionOS 1.0, macCatalyst 15.2, *)
9191
public init(
9292
url: URL,
9393
activityButton: ActivityButton? = nil,
@@ -105,7 +105,7 @@ public struct SafariView: View {
105105
}
106106

107107
/// A convenience typealias for [`SFSafariViewController.ActivityButton`](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/activitybutton)
108-
@available(iOS 15.0, macCatalyst 15.0, *)
108+
@available(iOS 15.0, visionOS 1.0, macCatalyst 15.0, *)
109109
public typealias ActivityButton = SFSafariViewController.ActivityButton
110110

111111
/// Prewarm the connection to a list of provided URLs
@@ -120,22 +120,22 @@ public struct SafariView: View {
120120
///
121121
/// - Parameter URLs: The URLs to prewarm
122122
/// - Returns: A prewarming token for the provided URLs.
123-
@available(iOS 15.0, macCatalyst 15.0, *)
123+
@available(iOS 15.0, visionOS 1.0, macCatalyst 15.0, *)
124124
@discardableResult
125125
public static func prewarmConnections(to URLs: [URL]) -> PrewarmingToken {
126126
let token = SFSafariViewController.prewarmConnections(to: URLs)
127127
return .init(token, urls: URLs)
128128
}
129129

130130
/// Clears the safari view's cache using [Swift Concurrency](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency/).
131-
@available(iOS 16.0, macCatalyst 16.0, *)
131+
@available(iOS 16.0, visionOS 1.0, macCatalyst 16.0, *)
132132
public static func clearWebsiteData() async {
133133
await SFSafariViewController.DataStore.default.clearWebsiteData()
134134
}
135135

136136
/// Clears the safari view's cache using a completion handler.
137137
/// - Parameter completionHandler: Closure to execute after the operation completes
138-
@available(iOS 16.0, macCatalyst 16.0, *)
138+
@available(iOS 16.0, visionOS 1.0, macCatalyst 16.0, *)
139139
public static func clearWebsiteData(completionHandler: (() -> Void)?) {
140140
SFSafariViewController.DataStore.default.clearWebsiteData(completionHandler: completionHandler)
141141
}

Sources/WebAuthentication/Modifiers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import SwiftUI
2727

28-
@available(iOS 14.0, macCatalyst 14.0, *)
28+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
2929
public extension View {
3030

3131
/// Set the private authentication requirements for authentication sessions within this view.

Sources/WebAuthentication/Presentation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import SwiftUI
2727

28-
@available(iOS 14.0, macCatalyst 14.0, *)
28+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
2929
public extension View {
3030

3131
/// Presents a ``WebAuthentication`` when a binding to a Boolean value that you provide is `true`.

Sources/WebAuthentication/WebAuthentication.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import AuthenticationServices
2727
import SwiftUI
2828

2929
/// A wrapper for `ASWebAuthenticationSession` in SwiftUI
30-
@available(iOS 14.0, macCatalyst 14.0, *)
30+
@available(iOS 14.0, visionOS 1.0, macCatalyst 14.0, *)
3131
public struct WebAuthentication {
3232

3333
// MARK: - Initializers

0 commit comments

Comments
 (0)