Skip to content

Commit 194dba6

Browse files
authored
Merge pull request #25454 from lorentey/nsvalue-availability
[Foundation] Set correct availability on NSValue.value(of:)
2 parents 308d584 + 8ae7634 commit 194dba6

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

stdlib/public/Darwin/Foundation/NSValue.swift.gyb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ${ ObjectiveCBridgeableImplementationForNSValue("CGSize") }
2424
${ ObjectiveCBridgeableImplementationForNSValue("CGAffineTransform") }
2525

2626
extension NSValue {
27-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
27+
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
2828
public func value<StoredType>(of type: StoredType.Type) -> StoredType? {
2929
if StoredType.self is AnyObject.Type {
3030
let encoding = String(cString: objCType)
@@ -42,11 +42,7 @@ extension NSValue {
4242
}
4343
let allocated = UnsafeMutablePointer<StoredType>.allocate(capacity: 1)
4444
defer { allocated.deallocate() }
45-
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
46-
getValue(allocated, size: storedSize)
47-
} else {
48-
getValue(allocated)
49-
}
45+
getValue(allocated, size: storedSize)
5046
return allocated.pointee
5147
}
5248
return nil

test/stdlib/NSValueBridging.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ nsValueBridging.test("NSValue can only be cast back to its original type") {
9292
}
9393

9494
nsValueBridging.test("NSValue fetching method should be able to convert constructed values safely") {
95-
guard #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) else { return }
95+
guard #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) else { return }
9696

9797
let range = NSRange(location: 17, length: 38)
9898
let value = NSValue(range: range)

0 commit comments

Comments
 (0)