Skip to content

[gardening] Prefer macOS over OSX for @available #1501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Foundation/JSONEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ open class JSONEncoder {
public static let prettyPrinted = OutputFormatting(rawValue: 1 << 0)

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

Expand All @@ -50,7 +50,7 @@ open class JSONEncoder {
case millisecondsSince1970

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

/// Encode the `Date` as a string formatted by the given formatter.
Expand Down Expand Up @@ -822,7 +822,7 @@ open class JSONDecoder {
case millisecondsSince1970

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

/// Decode the `Date` as a string parsed by the given formatter.
Expand Down Expand Up @@ -2151,7 +2151,7 @@ fileprivate struct _JSONKey : CodingKey {
//===----------------------------------------------------------------------===//

// 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.
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
fileprivate var _iso8601Formatter: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
formatter.formatOptions = .withInternetDateTime
Expand Down
18 changes: 9 additions & 9 deletions Foundation/Measurement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import _SwiftCoreFoundationOverlayShims
/// A `Measurement` is a model type that holds a `Double` value associated with a `Unit`.
///
/// Measurements support a large set of operators, including `+`, `-`, `*`, `/`, and a full set of comparison operators.
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
public struct Measurement<UnitType : Unit> : ReferenceConvertible, Comparable, Equatable {
public typealias ReferenceType = NSMeasurement

Expand All @@ -41,7 +41,7 @@ public struct Measurement<UnitType : Unit> : ReferenceConvertible, Comparable, E
}
}

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


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

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

@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
extension Measurement : MeasurementBridgeType {
@_semantics("convertToObjectiveC")
public func _bridgeToObjectiveC() -> NSMeasurement {
Expand All @@ -238,7 +238,7 @@ extension Measurement : MeasurementBridgeType {
}
}

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

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

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

@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
extension Measurement : Codable {
private enum CodingKeys : Int, CodingKey {
case value
Expand Down
12 changes: 6 additions & 6 deletions Foundation/NSStringAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ extension StringProtocol where Index == String.Index {

/// A capitalized representation of the string that is produced
/// using the current locale.
@available(OSX 10.11, iOS 9.0, *)
@available(macOS 10.11, iOS 9.0, *)
public var localizedCapitalized: String {
return _ns.localizedCapitalized
}
Expand Down Expand Up @@ -888,7 +888,7 @@ extension StringProtocol where Index == String.Index {

/// A lowercase version of the string that is produced using the current
/// locale.
@available(OSX 10.11, iOS 9.0, *)
@available(macOS 10.11, iOS 9.0, *)
public var localizedLowercase: String {
return _ns.localizedLowercase
}
Expand Down Expand Up @@ -953,7 +953,7 @@ extension StringProtocol where Index == String.Index {
/// similar to how searches are done generally in the system. The search is
/// locale-aware, case and diacritic insensitive. The exact list of search
/// options applied may change over time.
@available(OSX 10.11, iOS 9.0, *)
@available(macOS 10.11, iOS 9.0, *)
public func localizedStandardContains<
T : StringProtocol
>(_ string: T) -> Bool {
Expand Down Expand Up @@ -1128,7 +1128,7 @@ extension StringProtocol where Index == String.Index {

/// An uppercase version of the string that is produced using the current
/// locale.
@available(OSX 10.11, iOS 9.0, *)
@available(macOS 10.11, iOS 9.0, *)
public var localizedUppercase: String {
return _ns.localizedUppercase as String
}
Expand Down Expand Up @@ -1185,7 +1185,7 @@ extension StringProtocol where Index == String.Index {

#if !DEPLOYMENT_RUNTIME_SWIFT
/// Perform string transliteration.
@available(OSX 10.11, iOS 9.0, *)
@available(macOS 10.11, iOS 9.0, *)
public func applyingTransform(
_ transform: StringTransform, reverse: Bool
) -> String? {
Expand Down Expand Up @@ -1604,7 +1604,7 @@ extension StringProtocol where Index == String.Index {
/// similar to how searches are done generally in the system. The search is
/// locale-aware, case and diacritic insensitive. The exact list of search
/// options applied may change over time.
@available(OSX 10.11, iOS 9.0, *)
@available(macOS 10.11, iOS 9.0, *)
public func localizedStandardRange<
T : StringProtocol
>(of string: T) -> Range<Index>? {
Expand Down