Skip to content

Commit 57b2fad

Browse files
committed
[Foundation] add hints for replacement APIs for Data of some common usage from NSData
This provides a hint to the proper API to use for struct Data when developers are migrating from NSData. Purely a fixit addition (no actual functional code) <rdar://problem/26206061> Missing fixit for Data.getBytes
1 parent 1fe3f9f commit 57b2fad

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

stdlib/public/SDK/Foundation/Data.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,13 @@ extension Data : CustomStringConvertible, CustomDebugStringConvertible, CustomRe
733733
}
734734
}
735735

736+
extension Data {
737+
@available(*, unavailable, renamed: "copyBytes(to:count:)")
738+
public func getBytes(_ buffer: UnsafeMutablePointer<Swift.Void>, length: Int) { }
739+
740+
@available(*, unavailable, renamed: "copyBytes(to:from:)")
741+
public func getBytes(_ buffer: UnsafeMutablePointer<Swift.Void>, range: NSRange) { }
742+
}
736743

737744
/// Provides bridging functionality for struct Data to class NSData and vice-versa.
738745
extension Data : _ObjectiveCBridgeable {

0 commit comments

Comments
 (0)