Skip to content

Commit d7fd5f2

Browse files
committed
[gardening] Prefer macOS over OSX for #available
1 parent 6501fa2 commit d7fd5f2

9 files changed

+15
-15
lines changed

Foundation/Calendar.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ public struct Calendar : Hashable, Equatable, ReferenceConvertible, _MutableBoxi
10511051
}
10521052

10531053
internal static func _toNSCalendarIdentifier(_ identifier: Identifier) -> NSCalendar.Identifier {
1054-
if #available(OSX 10.10, iOS 8.0, *) {
1054+
if #available(macOS 10.10, iOS 8.0, *) {
10551055
let identifierMap: [Identifier : NSCalendar.Identifier] =
10561056
[.gregorian: .gregorian,
10571057
.buddhist: .buddhist,
@@ -1091,7 +1091,7 @@ public struct Calendar : Hashable, Equatable, ReferenceConvertible, _MutableBoxi
10911091
}
10921092

10931093
internal static func _fromNSCalendarIdentifier(_ identifier: NSCalendar.Identifier) -> Identifier {
1094-
if #available(OSX 10.10, iOS 8.0, *) {
1094+
if #available(macOS 10.10, iOS 8.0, *) {
10951095
let identifierMap: [NSCalendar.Identifier : Identifier] =
10961096
[.gregorian: .gregorian,
10971097
.buddhist: .buddhist,

Foundation/Data.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import _SwiftFoundationOverlayShims
3939
import _SwiftCoreFoundationOverlayShims
4040

4141
internal func __NSDataIsCompact(_ data: NSData) -> Bool {
42-
if #available(OSX 10.10, iOS 9.0, tvOS 9.0, watchOS 2.0, *) {
42+
if #available(macOS 10.10, iOS 9.0, tvOS 9.0, watchOS 2.0, *) {
4343
return data._isCompact()
4444
} else {
4545
var compact = true

Foundation/HTTPCookieStorage.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ open class HTTPCookieStorage: NSObject {
4848
private var _allCookies: [String: HTTPCookie]
4949
private var allCookies: [String: HTTPCookie] {
5050
get {
51-
if #available(OSX 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
51+
if #available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
5252
dispatchPrecondition(condition: DispatchPredicate.onQueue(self.syncQ))
5353
}
5454
return self._allCookies
5555
}
5656
set {
57-
if #available(OSX 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
57+
if #available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
5858
dispatchPrecondition(condition: DispatchPredicate.onQueue(self.syncQ))
5959
}
6060
self._allCookies = newValue
@@ -200,7 +200,7 @@ open class HTTPCookieStorage: NSObject {
200200
}
201201

202202
private func updatePersistentStore() {
203-
if #available(OSX 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
203+
if #available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
204204
dispatchPrecondition(condition: DispatchPredicate.onQueue(self.syncQ))
205205
}
206206

Foundation/JSONEncoder.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ extension _JSONEncoder {
650650
return NSNumber(value: 1000.0 * date.timeIntervalSince1970)
651651

652652
case .iso8601:
653-
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
653+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
654654
return NSString(string: _iso8601Formatter.string(from: date))
655655
} else {
656656
fatalError("ISO8601DateFormatter is unavailable on this platform.")
@@ -2023,7 +2023,7 @@ extension _JSONDecoder {
20232023
return Date(timeIntervalSince1970: double / 1000.0)
20242024

20252025
case .iso8601:
2026-
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
2026+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
20272027
let string = try self.unbox(value, as: String.self)!
20282028
guard let date = _iso8601Formatter.date(from: string) else {
20292029
throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: self.codingPath, debugDescription: "Expected date string to be ISO8601-formatted."))

Foundation/NSStringAPI.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ extension StringProtocol where Index == String.Index {
16381638
/// Equivalent to `self.rangeOfString(other) != nil`
16391639
public func contains<T : StringProtocol>(_ other: T) -> Bool {
16401640
let r = self.range(of: other) != nil
1641-
if #available(OSX 10.10, iOS 8.0, *) {
1641+
if #available(macOS 10.10, iOS 8.0, *) {
16421642
_sanityCheck(r == _ns.contains(other._ephemeralString))
16431643
}
16441644
return r
@@ -1661,7 +1661,7 @@ extension StringProtocol where Index == String.Index {
16611661
let r = self.range(
16621662
of: other, options: .caseInsensitive, locale: Locale.current
16631663
) != nil
1664-
if #available(OSX 10.10, iOS 8.0, *) {
1664+
if #available(macOS 10.10, iOS 8.0, *) {
16651665
_sanityCheck(r ==
16661666
_ns.localizedCaseInsensitiveContains(other._ephemeralString))
16671667
}

Foundation/URLComponents.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ extension URLComponents : CustomStringConvertible, CustomDebugStringConvertible,
315315
if let p = self.port { c.append((label: "port", value: p)) }
316316

317317
c.append((label: "path", value: self.path))
318-
if #available(OSX 10.10, iOS 8.0, *) {
318+
if #available(macOS 10.10, iOS 8.0, *) {
319319
if let qi = self.queryItems { c.append((label: "queryItems", value: qi )) }
320320
}
321321
if let f = self.fragment { c.append((label: "fragment", value: f)) }

TestFoundation/TestJSONEncoder.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class TestJSONEncoder : XCTestCase {
108108
let expectedJSON = "{\"email\":\"appleseed@apple.com\",\"name\":\"Johnny Appleseed\"}".data(using: .utf8)!
109109
let person = Person.testValue
110110
#if os(OSX) || DARWIN_COMPATIBILITY_TESTS
111-
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
111+
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
112112
_testRoundTrip(of: person, expectedJSON: expectedJSON, outputFormatting: [.sortedKeys])
113113
}
114114
#else
@@ -120,7 +120,7 @@ class TestJSONEncoder : XCTestCase {
120120
let expectedJSON = "{\n \"email\" : \"appleseed@apple.com\",\n \"name\" : \"Johnny Appleseed\"\n}".data(using: .utf8)!
121121
let person = Person.testValue
122122
#if os(OSX) || DARWIN_COMPATIBILITY_TESTS
123-
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
123+
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
124124
_testRoundTrip(of: person, expectedJSON: expectedJSON, outputFormatting: [.prettyPrinted, .sortedKeys])
125125
}
126126
#else

TestFoundation/TestJSONSerialization.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ extension TestJSONSerialization {
14751475
let dict3 = ["c": ["c":1,"b":1,"a":1],"b":["c":1,"b":1,"a":1],"a":["c":1,"b":1,"a":1]]
14761476

14771477
#if DARWIN_COMPATIBILITY_TESTS
1478-
if #available(OSX 10.13, *) {
1478+
if #available(macOS 10.13, *) {
14791479
XCTAssertEqual(try trySerialize(dict1, options: .sortedKeys), "{\"q\":1,\"r\":1,\"s\":1,\"t\":1,\"u\":1,\"v\":1,\"w\":1,\"x\":1,\"y\":1,\"z\":1}")
14801480
XCTAssertEqual(try trySerialize(dict2, options: .sortedKeys), "{\"a\":1,\"aa\":1,\"aaa\":1,\"aaaa\":1}")
14811481
XCTAssertEqual(try trySerialize(dict3, options: .sortedKeys), "{\"a\":{\"a\":1,\"b\":1,\"c\":1},\"b\":{\"a\":1,\"b\":1,\"c\":1},\"c\":{\"a\":1,\"b\":1,\"c\":1}}")

TestFoundation/TestNSArray.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ class TestNSArray : XCTestCase {
722722
let url = URL(fileURLWithPath: testFile)
723723
let data2: NSArray
724724
#if DARWIN_COMPATIBILITY_TESTS
725-
if #available(OSX 10.13, *) {
725+
if #available(macOS 10.13, *) {
726726
try data.write(to: url)
727727
data2 = try NSArray(contentsOf: url, error: ())
728728
} else {

0 commit comments

Comments
 (0)