Skip to content

Commit 2eb877b

Browse files
committed
Add availability checks for visionOS to integrations
1 parent 5721c1a commit 2eb877b

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

Sources/RswiftResources/Integrations/ColorResource+Integrations.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99
import SwiftUI
1010

11-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
11+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
1212
extension Color {
1313

1414
/**
@@ -22,7 +22,7 @@ extension Color {
2222
}
2323

2424

25-
#if os(iOS) || os(tvOS)
25+
#if os(iOS) || os(tvOS) || os(visionOS)
2626
import UIKit
2727

2828
extension ColorResource {

Sources/RswiftResources/Integrations/FontResource+Integrations.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99
import SwiftUI
1010

1111

12-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
12+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
1313
extension Font {
1414

1515
/**
@@ -22,15 +22,15 @@ extension Font {
2222
/**
2323
Create a custom font from this resource (`R.font.*`) and a fixed size that does not scale with Dynamic Type.
2424
*/
25-
@available(macOS 11, iOS 14, tvOS 14, watchOS 7, *)
25+
@available(macOS 11, iOS 14, tvOS 14, watchOS 7, visionOS 1, *)
2626
public static func custom(_ resource: FontResource, fixedSize: CGFloat) -> Font {
2727
.custom(resource.name, fixedSize: fixedSize)
2828
}
2929

3030
/**
3131
Create a custom font from this resource (`R.font.*`) and and size that is relative to the given `textStyle`.
3232
*/
33-
@available(macOS 11, iOS 14, tvOS 14, watchOS 7, *)
33+
@available(macOS 11, iOS 14, tvOS 14, watchOS 7, visionOS 1, *)
3434
public static func custom(_ resource: FontResource, size: CGFloat, relativeTo textStyle: Font.TextStyle) -> Font {
3535
.custom(resource.name, size: size, relativeTo: textStyle)
3636
}

Sources/RswiftResources/Integrations/ImageResource+Integrations.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99
import SwiftUI
1010

1111

12-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
12+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
1313
extension Image {
1414

1515
/**
@@ -46,7 +46,7 @@ extension Image {
4646
// Xcode 14 doesn't recognize `variableValue` init, Xcode 14.1 does know `variableValue`
4747
// Xcode 14.1 is first to ship with swift 5.7.1
4848
#if swift(>=5.7.1)
49-
@available(macOS 13, iOS 16, tvOS 16, watchOS 9, *)
49+
@available(macOS 13, iOS 16, tvOS 16, watchOS 9, visionOS 1, *)
5050
extension Image {
5151

5252
/**
@@ -85,7 +85,7 @@ extension Image {
8585
#endif
8686

8787

88-
#if os(iOS) || os(tvOS)
88+
#if os(iOS) || os(tvOS) || os(visionOS)
8989
import UIKit
9090

9191
extension ImageResource {
@@ -126,7 +126,7 @@ extension UIImage {
126126

127127
- returns: An image that exactly or best matches the configuration of the given resource (`R.image.*`), or nil if no suitable image was found.
128128
*/
129-
@available(iOS 13, tvOS 13, *)
129+
@available(iOS 13, tvOS 13, visionOS 1, *)
130130
public convenience init?(resource: ImageResource, with configuration: UIImage.Configuration?) {
131131
self.init(named: resource.name, in: resource.bundle, with: configuration)
132132
}
@@ -136,7 +136,7 @@ extension UIImage {
136136

137137
// Xcode 14 doesn't recognize `variableValue` init, Xcode 14.1 does know `variableValue`
138138
// Xcode 14.1 is first to ship with swift 5.7.1
139-
#if swift(>=5.7.1) && (os(iOS) || os(tvOS))
139+
#if swift(>=5.7.1) && (os(iOS) || os(tvOS)) || os(visionOS)
140140
extension UIImage {
141141
/**
142142
Returns the image from this resource (`R.image.*`) using the configuration, and variable value specified.
@@ -147,7 +147,7 @@ extension UIImage {
147147

148148
- returns: An image that exactly or best matches the configuration of the given resource (`R.image.*`), or nil if no suitable image was found.
149149
*/
150-
@available(iOS 16, tvOS 16, *)
150+
@available(iOS 16, tvOS 16, visionOS 1, *)
151151
public convenience init?(resource: ImageResource, variableValue: Double, with configuration: UIImage.Configuration? = nil) {
152152
self.init(named: resource.name, in: resource.bundle, variableValue: variableValue, configuration: configuration)
153153
}

Sources/RswiftResources/Integrations/StoryboardReference+Integrations.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extension StoryboardReference where Self: InitialControllerContainer {
2727

2828
- returns: The initial view controller in the storyboard.
2929
*/
30-
@available(iOS 13.0, tvOS 13.0, *)
30+
@available(iOS 13.0, tvOS 13.0, visionOS 1, *)
3131
public func instantiateInitialViewController(creator: @escaping (NSCoder) -> InitialController?) -> InitialController? where InitialController: UIViewController {
3232
UIStoryboard(name: name, bundle: bundle).instantiateInitialViewController(creator: creator)
3333
}
@@ -51,7 +51,7 @@ extension StoryboardViewControllerIdentifier {
5151

5252
- returns: The view controller corresponding to the specified resource (`R.storyboard.*.*`).
5353
*/
54-
@available(iOS 13.0, tvOS 13.0, *)
54+
@available(iOS 13.0, tvOS 13.0, visionOS 1, *)
5555
public func callAsFunction(creator: @escaping (NSCoder) -> ViewController?) -> ViewController? where ViewController: UIViewController {
5656
UIStoryboard(name: storyboard, bundle: bundle).instantiateViewController(identifier: identifier, creator: creator)
5757
}

Sources/RswiftResources/Integrations/StringResource+Integrations.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ extension String {
119119
}
120120

121121

122-
@available(macOS 10, iOS 13, tvOS 13, watchOS 6, *)
122+
@available(macOS 10, iOS 13, tvOS 13, watchOS 6, visionOS 1, *)
123123
extension Text {
124124
public init(_ resource: StringResource) {
125125
self.init(String(resource: resource))
@@ -191,7 +191,7 @@ extension StringResource {
191191
String(resource: self, preferredLanguages: preferredLanguages)
192192
}
193193

194-
// @available(macOS 13, iOS 16, tvOS 16, watchOS 9, *)
194+
// @available(macOS 13, iOS 16, tvOS 16, watchOS 9, visionOS 1, *)
195195
// public var localizedStringResource: LocalizedStringResource {
196196
// LocalizedStringResource(key, defaultValue: String.LocalizationValue(stringLiteral: defaultValue), bundle: bundle == .main ? .main : .atURL(bundle.bundleURL), comment: comment)
197197
// }

0 commit comments

Comments
 (0)