Skip to content

Commit bca5d3d

Browse files
authored
Update availability macros for macOS 15 deployment target (#1397)
1 parent 4e679a9 commit bca5d3d

File tree

70 files changed

+413
-427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+413
-427
lines changed

CMakeLists.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,11 @@ list(APPEND CMAKE_MODULE_PATH ${SwiftFoundation_SOURCE_DIR}/cmake/modules)
9494

9595
# Availability Macros (only applies to FoundationEssentials and FoundationInternationalization)
9696
set(_SwiftFoundation_BaseAvailability "macOS 15, iOS 18, tvOS 18, watchOS 11")
97+
set(_SwiftFoundation_macOS26Availability "macOS 26, iOS 26, tvOS 26, watchOS 26")
9798
set(_SwiftFoundation_FutureAvailability "macOS 10000, iOS 10000, tvOS 10000, watchOS 10000")
9899

99100
# All versions to define for each availability name
100101
list(APPEND _SwiftFoundation_versions
101-
"0.1"
102-
"0.2"
103-
"0.3"
104-
"0.4"
105102
"6.0.2"
106103
"6.1"
107104
"6.2"
@@ -110,16 +107,12 @@ list(APPEND _SwiftFoundation_versions
110107
# Each availability name to define
111108
list(APPEND _SwiftFoundation_availability_names
112109
"FoundationPreview"
113-
"FoundationPredicate"
114-
"FoundationPredicateRegex"
115110
"FoundationSpan")
116111

117112
# The aligned availability for each name (in the same order)
118113
list(APPEND _SwiftFoundation_availability_releases
119114
${_SwiftFoundation_BaseAvailability}
120-
${_SwiftFoundation_BaseAvailability}
121-
${_SwiftFoundation_BaseAvailability}
122-
${_SwiftFoundation_FutureAvailability})
115+
${_SwiftFoundation_macOS26Availability})
123116

124117
foreach(version ${_SwiftFoundation_versions})
125118
foreach(name release IN ZIP_LISTS _SwiftFoundation_availability_names _SwiftFoundation_availability_releases)

Package.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ import CompilerPluginSupport
77
// Availability Macros
88

99
let availabilityTags: [_Availability] = [
10-
_Availability("FoundationPreview"), // Default FoundationPreview availability,
11-
_Availability("FoundationPredicate"), // Predicate relies on pack parameter runtime support
12-
_Availability("FoundationPredicateRegex"), // Predicate regexes rely on new stdlib APIs
13-
_Availability("FoundationSpan", availability: .future), // Availability of Span types
10+
_Availability("FoundationPreview"), // Default FoundationPreview availability
11+
_Availability("FoundationSpan", availability: .macOS26), // Availability of Span types
1412
]
15-
let versionNumbers = ["0.1", "0.2", "0.3", "0.4", "6.0.2", "6.1", "6.2"]
13+
let versionNumbers = ["6.0.2", "6.1", "6.2"]
1614

1715
// Availability Macro Utilities
1816

1917
enum _OSAvailability: String {
2018
case alwaysAvailable = "macOS 15, iOS 18, tvOS 18, watchOS 11" // This should match the package's deployment target
19+
case macOS26 = "macOS 26, iOS 26, tvOS 26, watchOS 26"
2120
// Use 10000 for future availability to avoid compiler magic around the 9999 version number but ensure it is greater than 9999
2221
case future = "macOS 10000, iOS 10000, tvOS 10000, watchOS 10000"
2322
}

Sources/FoundationEssentials/AttributedString/AttributedString+CharacterView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ extension AttributedString.CharacterView: BidirectionalCollection {
123123
return _defaultCount
124124
}
125125

126-
@available(FoundationPreview 0.1, *)
126+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
127127
@usableFromInline
128128
internal var _count: Int {
129129
_characters.count
@@ -153,7 +153,7 @@ extension AttributedString.CharacterView: BidirectionalCollection {
153153
return _defaultIndex(i, offsetBy: distance)
154154
}
155155

156-
@available(FoundationPreview 0.1, *)
156+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
157157
@usableFromInline
158158
internal func _index(_ i: AttributedString.Index, offsetBy distance: Int) -> AttributedString.Index {
159159
precondition(i >= startIndex && i <= endIndex, "AttributedString index out of bounds")
@@ -176,7 +176,7 @@ extension AttributedString.CharacterView: BidirectionalCollection {
176176
return _defaultIndex(i, offsetBy: distance, limitedBy: limit)
177177
}
178178

179-
@available(FoundationPreview 0.1, *)
179+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
180180
@usableFromInline
181181
internal func _index(
182182
_ i: AttributedString.Index,
@@ -207,7 +207,7 @@ extension AttributedString.CharacterView: BidirectionalCollection {
207207
return _defaultDistance(from: start, to: end)
208208
}
209209

210-
@available(FoundationPreview 0.1, *)
210+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
211211
@usableFromInline
212212
internal func _distance(from start: AttributedString.Index, to end: AttributedString.Index) -> Int {
213213
precondition(start >= startIndex && start <= endIndex, "AttributedString index out of bounds")

Sources/FoundationEssentials/AttributedString/AttributedString+Runs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ extension AttributedString.Runs: BidirectionalCollection {
366366
#endif
367367
}
368368

369-
@available(FoundationPreview 0.1, *)
369+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
370370
@usableFromInline
371371
internal func _index(_ index: Index, offsetBy distance: Int) -> Index {
372372
guard _isDiscontiguous else {

Sources/FoundationEssentials/AttributedString/AttributedString+UnicodeScalarView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ extension AttributedString.UnicodeScalarView: BidirectionalCollection {
124124
return _defaultCount
125125
}
126126

127-
@available(FoundationPreview 0.1, *)
127+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
128128
@usableFromInline
129129
internal var _count: Int {
130130
_unicodeScalars.count
@@ -165,7 +165,7 @@ extension AttributedString.UnicodeScalarView: BidirectionalCollection {
165165
return _defaultIndex(i, offsetBy: distance, limitedBy: limit)
166166
}
167167

168-
@available(FoundationPreview 0.1, *)
168+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
169169
@usableFromInline
170170
internal func _index(
171171
_ i: AttributedString.Index,

Sources/FoundationEssentials/AttributedString/Conversion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extension String {
4141
}
4242
#endif
4343

44-
@available(FoundationPreview 0.1, *)
44+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
4545
@usableFromInline
4646
internal init(_characters: AttributedString.CharacterView) {
4747
self.init(_characters._characters)

Sources/FoundationEssentials/AttributedString/FoundationAttributes.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ extension AttributeScopes {
4040
public let writingDirection: WritingDirectionAttribute
4141

4242
#if FOUNDATION_FRAMEWORK
43-
@available(FoundationPreview 0.1, *)
43+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
4444
public let agreementConcept: AgreementConceptAttribute
45-
@available(FoundationPreview 0.1, *)
45+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
4646
public let agreementArgument: AgreementArgumentAttribute
47-
@available(FoundationPreview 0.1, *)
47+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
4848
public let referentConcept: ReferentConceptAttribute
49-
@available(FoundationPreview 0.4, *)
49+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
5050
public let localizedNumberFormat: LocalizedNumberFormatAttribute
5151

5252
// TODO: Support AttributedString markdown in FoundationPreview: https://github.com/apple/swift-foundation/issues/44
@@ -119,23 +119,23 @@ extension AttributeScopes.FoundationAttributes {
119119
#if FOUNDATION_FRAMEWORK
120120

121121
@frozen
122-
@available(FoundationPreview 0.1, *)
122+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
123123
public enum ReferentConceptAttribute : CodableAttributedStringKey, MarkdownDecodableAttributedStringKey {
124124
public typealias Value = Int
125125
public static let name = NSAttributedString.Key.referentConcept.rawValue
126126
public static let markdownName = "referentConcept"
127127
}
128128

129129
@frozen
130-
@available(FoundationPreview 0.1, *)
130+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
131131
public enum AgreementConceptAttribute : CodableAttributedStringKey, MarkdownDecodableAttributedStringKey {
132132
public typealias Value = Int
133133
public static let name = NSAttributedString.Key.agreeWithConcept.rawValue
134134
public static let markdownName = "agreeWithConcept"
135135
}
136136

137137
@frozen
138-
@available(FoundationPreview 0.1, *)
138+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
139139
public enum AgreementArgumentAttribute : CodableAttributedStringKey, MarkdownDecodableAttributedStringKey {
140140
public typealias Value = Int
141141
public static let name = NSAttributedString.Key.agreeWithArgument.rawValue
@@ -168,7 +168,7 @@ extension AttributeScopes.FoundationAttributes {
168168
}
169169

170170
@frozen
171-
@available(FoundationPreview 0.4, *)
171+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
172172
public enum LocalizedNumberFormatAttribute : CodableAttributedStringKey, MarkdownDecodableAttributedStringKey {
173173
public struct Value: Equatable, Hashable, Codable, Sendable {
174174
enum Format {
@@ -851,7 +851,7 @@ extension AttributeScopes.FoundationAttributes.PersonNameComponentAttribute : Ob
851851
public typealias ObjectiveCValue = NSString
852852
}
853853

854-
@available(FoundationPreview 0.4, *)
854+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
855855
extension AttributeScopes.FoundationAttributes.LocalizedNumberFormatAttribute.Value: _ObjectiveCBridgeable {
856856
public func _bridgeToObjectiveC() -> __NSLocalizedNumberFormatRule {
857857
switch self.format {

Sources/FoundationEssentials/Calendar/Calendar.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,10 @@ public struct Calendar : Hashable, Equatable, Sendable {
323323
case nanosecond
324324
case calendar
325325
case timeZone
326-
@available(FoundationPreview 0.1, *)
326+
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
327327
case isLeapMonth
328328

329-
@available(FoundationPreview 0.4, *)
329+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
330330
case dayOfYear
331331

332332
fileprivate var componentSetValue: ComponentSet.RawValue {
@@ -620,7 +620,7 @@ public struct Calendar : Hashable, Equatable, Sendable {
620620
/// - parameter value: The value of the specified component to add or subtract. The default value is `1`. The value can be negative, which causes subtraction.
621621
/// - parameter wrappingComponents: If `true`, the component should be incremented and wrap around to zero/one on overflow, and should not cause higher components to be incremented. The default value is `false`.
622622
/// - returns: A `Sequence` of `Date` values, or an empty sequence if no addition could be performed.
623-
@available(FoundationPreview 0.4, *)
623+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
624624
public func dates(byAdding component: Calendar.Component,
625625
value: Int = 1,
626626
startingAt start: Date,
@@ -641,7 +641,7 @@ public struct Calendar : Hashable, Equatable, Sendable {
641641
/// - parameter components: The components to add or subtract.
642642
/// - parameter wrappingComponents: If `true`, the component should be incremented and wrap around to zero/one on overflow, and should not cause higher components to be incremented. The default value is `false`.
643643
/// - returns: A `Sequence` of `Date` values, or an empty sequence if no addition could be performed.
644-
@available(FoundationPreview 0.4, *)
644+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
645645
public func dates(byAdding components: DateComponents,
646646
startingAt start: Date,
647647
in range: Range<Date>? = nil,
@@ -1222,7 +1222,7 @@ public struct Calendar : Hashable, Equatable, Sendable {
12221222
/// - parameter matchingPolicy: Determines the behavior of the search algorithm when the input produces an ambiguous result.
12231223
/// - parameter repeatedTimePolicy: Determines the behavior of the search algorithm when the input produces a time that occurs twice on a particular day.
12241224
/// - parameter direction: Which direction in time to search. The default value is `.forward`, which means later in time.
1225-
@available(FoundationPreview 0.4, *)
1225+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
12261226
public func dates(byMatching components: DateComponents,
12271227
startingAt start: Date,
12281228
in range: Range<Date>? = nil,
@@ -1617,7 +1617,7 @@ package struct WeekendRange: Equatable, Hashable {
16171617
}
16181618
}
16191619

1620-
@available(FoundationPreview 0.4, *)
1620+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
16211621
extension Calendar.MatchingPolicy: Codable {
16221622
public init(from decoder: Decoder) throws {
16231623
let container = try decoder.singleValueContainer()
@@ -1650,7 +1650,7 @@ extension Calendar.MatchingPolicy: Codable {
16501650
}
16511651
}
16521652

1653-
@available(FoundationPreview 0.4, *)
1653+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
16541654
extension Calendar.RepeatedTimePolicy: Codable {
16551655
public init(from decoder: Decoder) throws {
16561656
let container = try decoder.singleValueContainer()

Sources/FoundationEssentials/Calendar/Calendar_Enumerate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ extension Calendar {
15801580
return result
15811581
}
15821582

1583-
@available(FoundationPreview 0.4, *)
1583+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
15841584
internal func dateAfterMatchingDayOfYear(startingAt: Date, components: DateComponents, direction: SearchDirection) throws -> Date? {
15851585
guard let dayOfYear = components.dayOfYear else {
15861586
// Nothing to do

Sources/FoundationEssentials/Calendar/DateComponents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public struct DateComponents : Hashable, Equatable, Sendable {
271271
/// A day of the year.
272272
/// For example, in the Gregorian calendar, can go from 1 to 365 or 1 to 366 in leap years.
273273
/// - note: This value is interpreted in the context of the calendar in which it is used.
274-
@available(FoundationPreview 0.4, *)
274+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, *)
275275
public var dayOfYear: Int? {
276276
get { _dayOfYear }
277277
set { _dayOfYear = converted(newValue) }

0 commit comments

Comments
 (0)