Skip to content

Commit e0eadc2

Browse files
committed
[gardening][Foundation] Prefer macOS over OSX for @available
1 parent ced850a commit e0eadc2

17 files changed

+247
-247
lines changed

stdlib/public/SDK/Foundation/Calendar.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public struct Calendar : Hashable, Equatable, ReferenceConvertible, _MutableBoxi
4242
case republicOfChina
4343

4444
/// A simple tabular Islamic calendar using the astronomical/Thursday epoch of CE 622 July 15
45-
@available(OSX 10.10, iOS 8.0, *)
45+
@available(macOS 10.10, iOS 8.0, *)
4646
case islamicTabular
4747

4848
/// The Islamic Umm al-Qura calendar used in Saudi Arabia. This is based on astronomical calculation, instead of tabular behavior.
49-
@available(OSX 10.10, iOS 8.0, *)
49+
@available(macOS 10.10, iOS 8.0, *)
5050
case islamicUmmAlQura
5151

5252
}
@@ -417,7 +417,7 @@ public struct Calendar : Hashable, Equatable, ReferenceConvertible, _MutableBoxi
417417
/// - parameter component: A calendar component.
418418
/// - parameter date: The specified date.
419419
/// - returns: A new `DateInterval` if the starting time and duration of a component could be calculated, otherwise `nil`.
420-
@available(OSX 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
420+
@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
421421
public func dateInterval(of component: Component, for date: Date) -> DateInterval? {
422422
var start : Date = Date(timeIntervalSinceReferenceDate: 0)
423423
var interval : TimeInterval = 0
@@ -694,7 +694,7 @@ public struct Calendar : Hashable, Equatable, ReferenceConvertible, _MutableBoxi
694694
///
695695
/// - parameter date: The date contained in the weekend.
696696
/// - returns: A `DateInterval`, or nil if the date is not in a weekend.
697-
@available(OSX 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
697+
@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
698698
public func dateIntervalOfWeekend(containing date: Date) -> DateInterval? {
699699
var nsDate : NSDate?
700700
var ti : TimeInterval = 0
@@ -739,7 +739,7 @@ public struct Calendar : Hashable, Equatable, ReferenceConvertible, _MutableBoxi
739739
/// - parameter date: The date at which to begin the search.
740740
/// - parameter direction: Which direction in time to search. The default value is `.forward`.
741741
/// - returns: A `DateInterval`, or nil if weekends do not exist in the specific calendar or locale.
742-
@available(OSX 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
742+
@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
743743
public func nextWeekend(startingAfter date: Date, direction: SearchDirection = .forward) -> DateInterval? {
744744
// The implementation actually overrides previousKeepSmaller and nextKeepSmaller with matchNext, always - but strict still trumps all.
745745
var nsDate : NSDate?

stdlib/public/SDK/Foundation/DateComponents.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _Mutab
216216
/// Set the value of one of the properties, using an enumeration value instead of a property name.
217217
///
218218
/// The calendar and timeZone and isLeapMonth properties cannot be set by this method.
219-
@available(OSX 10.9, iOS 8.0, *)
219+
@available(macOS 10.9, iOS 8.0, *)
220220
public mutating func setValue(_ value: Int?, for component: Calendar.Component) {
221221
_applyMutation {
222222
$0.setValue(_setter(value), forComponent: Calendar._toCalendarUnit([component]))
@@ -226,7 +226,7 @@ public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _Mutab
226226
/// Returns the value of one of the properties, using an enumeration value instead of a property name.
227227
///
228228
/// The calendar and timeZone and isLeapMonth property values cannot be retrieved by this method.
229-
@available(OSX 10.9, iOS 8.0, *)
229+
@available(macOS 10.9, iOS 8.0, *)
230230
public func value(for component: Calendar.Component) -> Int? {
231231
return _handle.map {
232232
$0.value(forComponent: Calendar._toCalendarUnit([component]))
@@ -244,7 +244,7 @@ public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _Mutab
244244
/// If the time zone property is set in the `DateComponents`, it is used.
245245
///
246246
/// The calendar property must be set, or the result is always `false`.
247-
@available(OSX 10.9, iOS 8.0, *)
247+
@available(macOS 10.9, iOS 8.0, *)
248248
public var isValidDate: Bool {
249249
return _handle.map { $0.isValidDate }
250250
}
@@ -256,7 +256,7 @@ public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _Mutab
256256
/// Except for some trivial cases (e.g., 'seconds' should be 0 - 59 in any calendar), this method is not necessarily cheap.
257257
///
258258
/// If the time zone property is set in the `DateComponents`, it is used.
259-
@available(OSX 10.9, iOS 8.0, *)
259+
@available(macOS 10.9, iOS 8.0, *)
260260
public func isValidDate(in calendar: Calendar) -> Bool {
261261
return _handle.map { $0.isValidDate(in: calendar) }
262262
}

stdlib/public/SDK/Foundation/DateInterval.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import _SwiftCoreFoundationOverlayShims
1515

1616
/// DateInterval represents a closed date interval in the form of [startDate, endDate]. It is possible for the start and end dates to be the same with a duration of 0. DateInterval does not support reverse intervals i.e. intervals where the duration is less than 0 and the end date occurs earlier in time than the start date.
17-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
17+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
1818
public struct DateInterval : ReferenceConvertible, Comparable, Hashable, Codable {
1919
public typealias ReferenceType = NSDateInterval
2020

@@ -164,18 +164,18 @@ public struct DateInterval : ReferenceConvertible, Comparable, Hashable, Codable
164164
}
165165
}
166166

167-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
167+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
168168
public static func ==(lhs: DateInterval, rhs: DateInterval) -> Bool {
169169
return lhs.start == rhs.start && lhs.duration == rhs.duration
170170
}
171171

172-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
172+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
173173
public static func <(lhs: DateInterval, rhs: DateInterval) -> Bool {
174174
return lhs.compare(rhs) == .orderedAscending
175175
}
176176
}
177177

178-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
178+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
179179
extension DateInterval : CustomStringConvertible, CustomDebugStringConvertible, CustomReflectable {
180180
public var description: String {
181181
return "\(start) to \(end)"
@@ -194,7 +194,7 @@ extension DateInterval : CustomStringConvertible, CustomDebugStringConvertible,
194194
}
195195
}
196196

197-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
197+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
198198
extension DateInterval : _ObjectiveCBridgeable {
199199
public static func _getObjectiveCType() -> Any.Type {
200200
return NSDateInterval.self
@@ -223,7 +223,7 @@ extension DateInterval : _ObjectiveCBridgeable {
223223
}
224224
}
225225

226-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
226+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
227227
extension NSDateInterval : _HasCustomAnyHashableRepresentation {
228228
// Must be @nonobjc to avoid infinite recursion during bridging.
229229
@nonobjc

stdlib/public/SDK/Foundation/FileManager.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,22 @@ extension FileManager {
2727
}
2828

2929
@available(swift, obsoleted: 4)
30-
@available(OSX 10.6, iOS 4.0, *)
30+
@available(macOS 10.6, iOS 4.0, *)
3131
public func replaceItemAt(_ originalItemURL: URL, withItemAt newItemURL: URL, backupItemName: String? = nil, options: FileManager.ItemReplacementOptions = []) throws -> NSURL? {
3232
var error: NSError?
3333
guard let result = __NSFileManagerReplaceItemAtURL(self, originalItemURL, newItemURL , backupItemName, options, &error) else { throw error! }
3434
return result as NSURL
3535
}
3636

3737
@available(swift, introduced: 4)
38-
@available(OSX 10.6, iOS 4.0, *)
38+
@available(macOS 10.6, iOS 4.0, *)
3939
public func replaceItemAt(_ originalItemURL: URL, withItemAt newItemURL: URL, backupItemName: String? = nil, options: FileManager.ItemReplacementOptions = []) throws -> URL? {
4040
var error: NSError?
4141
guard let result = __NSFileManagerReplaceItemAtURL(self, originalItemURL, newItemURL , backupItemName, options, &error) else { throw error! }
4242
return result
4343
}
4444

45-
@available(OSX 10.6, iOS 4.0, *)
45+
@available(macOS 10.6, iOS 4.0, *)
4646
@nonobjc
4747
public func enumerator(at url: URL, includingPropertiesForKeys keys: [URLResourceKey]?, options mask: FileManager.DirectoryEnumerationOptions = [], errorHandler handler: ((URL, Error) -> Bool)? = nil) -> FileManager.DirectoryEnumerator? {
4848
return __NSFileManagerEnumeratorAtURL(self, url, keys, mask, { (url, error) in

stdlib/public/SDK/Foundation/JSONEncoder.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ open class JSONEncoder {
3232
public static let prettyPrinted = OutputFormatting(rawValue: 1 << 0)
3333

3434
/// Produce JSON with dictionary keys sorted in lexicographic order.
35-
@available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *)
35+
@available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *)
3636
public static let sortedKeys = OutputFormatting(rawValue: 1 << 1)
3737
}
3838

@@ -48,7 +48,7 @@ open class JSONEncoder {
4848
case millisecondsSince1970
4949

5050
/// Encode the `Date` as an ISO-8601-formatted string (in RFC 3339 format).
51-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
51+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
5252
case iso8601
5353

5454
/// Encode the `Date` as a string formatted by the given formatter.
@@ -947,7 +947,7 @@ open class JSONDecoder {
947947
case millisecondsSince1970
948948

949949
/// Decode the `Date` as an ISO-8601-formatted string (in RFC 3339 format).
950-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
950+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
951951
case iso8601
952952

953953
/// Decode the `Date` as a string parsed by the given formatter.
@@ -2416,7 +2416,7 @@ fileprivate struct _JSONKey : CodingKey {
24162416
//===----------------------------------------------------------------------===//
24172417

24182418
// NOTE: This value is implicitly lazy and _must_ be lazy. We're compiled against the latest SDK (w/ ISO8601DateFormatter), but linked against whichever Foundation the user has. ISO8601DateFormatter might not exist, so we better not hit this code path on an older OS.
2419-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
2419+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
24202420
fileprivate var _iso8601Formatter: ISO8601DateFormatter = {
24212421
let formatter = ISO8601DateFormatter()
24222422
formatter.formatOptions = .withInternetDateTime

stdlib/public/SDK/Foundation/Measurement.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import _SwiftCoreFoundationOverlayShims
2020
/// A `Measurement` is a model type that holds a `Double` value associated with a `Unit`.
2121
///
2222
/// Measurements support a large set of operators, including `+`, `-`, `*`, `/`, and a full set of comparison operators.
23-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
23+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
2424
public struct Measurement<UnitType : Unit> : ReferenceConvertible, Comparable, Equatable {
2525
public typealias ReferenceType = NSMeasurement
2626

@@ -41,7 +41,7 @@ public struct Measurement<UnitType : Unit> : ReferenceConvertible, Comparable, E
4141
}
4242
}
4343

44-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
44+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
4545
extension Measurement : CustomStringConvertible, CustomDebugStringConvertible, CustomReflectable {
4646
public var description: String {
4747
return "\(value) \(unit.symbol)"
@@ -61,7 +61,7 @@ extension Measurement : CustomStringConvertible, CustomDebugStringConvertible, C
6161

6262

6363
/// When a `Measurement` contains a `Dimension` unit, it gains the ability to convert between the kinds of units in that dimension.
64-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
64+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
6565
extension Measurement where UnitType : Dimension {
6666
/// Returns a new measurement created by converting to the specified unit.
6767
///
@@ -117,7 +117,7 @@ extension Measurement where UnitType : Dimension {
117117
}
118118
}
119119

120-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
120+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
121121
extension Measurement {
122122
/// Add two measurements of the same Unit.
123123
/// - precondition: The `unit` of `lhs` and `rhs` must be `isEqual`.
@@ -212,7 +212,7 @@ internal typealias MeasurementBridgeType = _ObjectTypeBridgeable
212212
internal typealias MeasurementBridgeType = _ObjectiveCBridgeable
213213
#endif
214214

215-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
215+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
216216
extension Measurement : MeasurementBridgeType {
217217
@_semantics("convertToObjectiveC")
218218
public func _bridgeToObjectiveC() -> NSMeasurement {
@@ -238,7 +238,7 @@ extension Measurement : MeasurementBridgeType {
238238
}
239239
}
240240

241-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
241+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
242242
extension NSMeasurement : _HasCustomAnyHashableRepresentation {
243243
// Must be @nonobjc to avoid infinite recursion during bridging.
244244
@nonobjc
@@ -252,7 +252,7 @@ extension NSMeasurement : _HasCustomAnyHashableRepresentation {
252252
}
253253

254254
// This workaround is required for the time being, because Swift doesn't support covariance for Measurement (26607639)
255-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
255+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
256256
extension MeasurementFormatter {
257257
public func string<UnitType>(from measurement: Measurement<UnitType>) -> String {
258258
if let result = string(for: measurement) {
@@ -263,7 +263,7 @@ extension MeasurementFormatter {
263263
}
264264
}
265265

266-
// @available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
266+
// @available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
267267
// extension Unit : Codable {
268268
// public convenience init(from decoder: Decoder) throws {
269269
// let container = try decoder.singleValueContainer()
@@ -277,7 +277,7 @@ extension MeasurementFormatter {
277277
// }
278278
// }
279279

280-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
280+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
281281
extension Measurement : Codable {
282282
private enum CodingKeys : Int, CodingKey {
283283
case value

stdlib/public/SDK/Foundation/NSCoder.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import _SwiftFoundationOverlayShims
1717
// NSCoder
1818
//===----------------------------------------------------------------------===//
1919

20-
@available(OSX 10.11, iOS 9.0, *)
20+
@available(macOS 10.11, iOS 9.0, *)
2121
internal func resolveError(_ error: NSError?) throws {
2222
if let error = error, error.code != NSCoderValueNotFoundError {
2323
throw error
@@ -57,7 +57,7 @@ extension NSCoder {
5757
}
5858

5959
@nonobjc
60-
@available(OSX 10.11, iOS 9.0, *)
60+
@available(macOS 10.11, iOS 9.0, *)
6161
public func decodeTopLevelObject() throws -> Any? {
6262
var error: NSError?
6363
let result = __NSCoderDecodeObject(self, &error)
@@ -72,7 +72,7 @@ extension NSCoder {
7272

7373
@nonobjc
7474
@available(swift, obsoleted: 4)
75-
@available(OSX 10.11, iOS 9.0, *)
75+
@available(macOS 10.11, iOS 9.0, *)
7676
public func decodeTopLevelObject(forKey key: String) throws -> AnyObject? {
7777
var error: NSError?
7878
let result = __NSCoderDecodeObjectForKey(self, key, &error)
@@ -82,7 +82,7 @@ extension NSCoder {
8282

8383
@nonobjc
8484
@available(swift, introduced: 4)
85-
@available(OSX 10.11, iOS 9.0, *)
85+
@available(macOS 10.11, iOS 9.0, *)
8686
public func decodeTopLevelObject(forKey key: String) throws -> Any? {
8787
var error: NSError?
8888
let result = __NSCoderDecodeObjectForKey(self, key, &error)
@@ -98,7 +98,7 @@ extension NSCoder {
9898
fatalError("This API has been renamed")
9999
}
100100

101-
@available(OSX 10.11, iOS 9.0, *)
101+
@available(macOS 10.11, iOS 9.0, *)
102102
public func decodeTopLevelObject<DecodedObjectType>(
103103
of cls: DecodedObjectType.Type, forKey key: String
104104
) throws -> DecodedObjectType?
@@ -116,7 +116,7 @@ extension NSCoder {
116116
}
117117

118118
@nonobjc
119-
@available(OSX 10.11, iOS 9.0, *)
119+
@available(macOS 10.11, iOS 9.0, *)
120120
public func decodeTopLevelObject(of classes: [AnyClass]?, forKey key: String) throws -> Any? {
121121
var error: NSError?
122122
var classesAsNSObjects: NSSet?
@@ -135,7 +135,7 @@ extension NSCoder {
135135

136136
extension NSKeyedArchiver {
137137
@nonobjc
138-
@available(OSX 10.11, iOS 9.0, *)
138+
@available(macOS 10.11, iOS 9.0, *)
139139
public func encodeEncodable<T : Encodable>(_ value: T, forKey key: String) throws {
140140
let plistEncoder = PropertyListEncoder()
141141
let plist = try plistEncoder.encodeToTopLevelContainer(value)
@@ -150,7 +150,7 @@ extension NSKeyedArchiver {
150150
extension NSKeyedUnarchiver {
151151
@nonobjc
152152
@available(swift, obsoleted: 4)
153-
@available(OSX 10.11, iOS 9.0, *)
153+
@available(macOS 10.11, iOS 9.0, *)
154154
public class func unarchiveTopLevelObjectWithData(_ data: NSData) throws -> AnyObject? {
155155
var error: NSError?
156156
let result = __NSKeyedUnarchiverUnarchiveObject(self, data, &error)
@@ -160,7 +160,7 @@ extension NSKeyedUnarchiver {
160160

161161
@nonobjc
162162
@available(swift, introduced: 4)
163-
@available(OSX 10.11, iOS 9.0, *)
163+
@available(macOS 10.11, iOS 9.0, *)
164164
public class func unarchiveTopLevelObjectWithData(_ data: Data) throws -> Any? {
165165
var error: NSError?
166166
let result = __NSKeyedUnarchiverUnarchiveObject(self, data as NSData, &error)
@@ -169,7 +169,7 @@ extension NSKeyedUnarchiver {
169169
}
170170

171171
@nonobjc
172-
@available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *)
172+
@available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *)
173173
public static func unarchivedObject<DecodedObjectType>(ofClass cls: DecodedObjectType.Type, from data: Data) throws -> DecodedObjectType? {
174174
var error: NSError?
175175
let result = __NSKeyedUnarchiverSecureUnarchiveObjectOfClass(cls as! AnyClass, data, &error)
@@ -178,7 +178,7 @@ extension NSKeyedUnarchiver {
178178
}
179179

180180
@nonobjc
181-
@available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *)
181+
@available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *)
182182
public static func unarchivedObject(ofClasses classes: [AnyClass], from data: Data) throws -> Any? {
183183
var error: NSError?
184184
let classesAsNSObjects = NSSet(array: classes.map { $0 as AnyObject })
@@ -198,7 +198,7 @@ extension NSKeyedUnarchiver {
198198
]
199199

200200
@nonobjc
201-
@available(OSX 10.11, iOS 9.0, *)
201+
@available(macOS 10.11, iOS 9.0, *)
202202
public func decodeDecodable<T : Decodable>(_ type: T.Type, forKey key: String) -> T? {
203203
guard let value = self.decodeObject(of: NSKeyedUnarchiver.__plistClasses, forKey: key) else {
204204
return nil
@@ -214,7 +214,7 @@ extension NSKeyedUnarchiver {
214214
}
215215

216216
@nonobjc
217-
@available(OSX 10.11, iOS 9.0, *)
217+
@available(macOS 10.11, iOS 9.0, *)
218218
public func decodeTopLevelDecodable<T : Decodable>(_ type: T.Type, forKey key: String) throws -> T? {
219219
guard let value = try self.decodeTopLevelObject(of: NSKeyedUnarchiver.__plistClasses, forKey: key) else {
220220
return nil

0 commit comments

Comments
 (0)