Skip to content

Commit 1dc8bb3

Browse files
authored
Revert "[Foundation] Fix availability of NSValue.value(of:)"
1 parent 1961979 commit 1dc8bb3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Darwin/Foundation-swiftoverlay/NSValue.swift.gyb

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

2626
extension NSValue {
27-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2827
public func value<StoredType>(of type: StoredType.Type) -> StoredType? {
2928
if StoredType.self is AnyObject.Type {
3029
let encoding = String(cString: objCType)
@@ -42,9 +41,13 @@ extension NSValue {
4241
}
4342
let allocated = UnsafeMutablePointer<StoredType>.allocate(capacity: 1)
4443
defer { allocated.deallocate() }
45-
getValue(allocated, size: storedSize)
44+
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
45+
getValue(allocated, size: storedSize)
46+
} else {
47+
getValue(allocated)
48+
}
4649
return allocated.pointee
4750
}
4851
return nil
4952
}
50-
}
53+
}

0 commit comments

Comments
 (0)