8

I do not understand the difference between swift 3 Data object and the previous NSData.

Why Apple did made this change?

luk2302
  • 55,258
  • 23
  • 97
  • 137
Bob5421
  • 7,757
  • 14
  • 81
  • 175
  • 1
    Take a read of [SE-0069: Mutability and Foundation Value Types](https://github.com/apple/swift-evolution/blob/master/proposals/0069-swift-mutability-for-foundation.md) – Hamish Jan 29 '17 at 15:24
  • 1
    From Apple - The Swift overlay to the Foundation framework provides the Data structure, which bridges to the NSData class and its mutable subclass, NSMutableData. The Data value type offers the same functionality as the NSData reference type, and the two can be used interchangeably in Swift code that interacts with Objective-C APIs. This behavior is similar to how Swift bridges standard string, numeric, and collection types to their corresponding Foundation classes. – Magnas Jan 29 '17 at 15:26
  • [This](https://www.quora.com/What-is-difference-between-NSData-and-Data-in-Swift) might be useful to your answer. – Ahmad F Jan 29 '17 at 16:31
  • 13
    The "duplicate" flag here is incorrect. The "duplicate" question referenced is about `Date`/`NSDate`, not `Data`/`NSData`. The answer may generally be the same, but the question is different. – Alan Kinnaman Jul 26 '17 at 21:43
  • Noted @namannik. Requested reopening of question. – quantumpotato Nov 08 '17 at 02:54

0 Answers0