[swift-users] NSData vs Data write to string differently?

Joe Groff jgroff at apple.com
Thu Sep 22 20:47:14 CDT 2016


> On Sep 22, 2016, at 4:04 PM, Shawn Erickson via swift-users <swift-users at swift.org> wrote:
> 
> In general you shouldn't depend on what description returns for classes, etc. outside of your control unless it is documented (e.g. part of the API contract). If you want a specific output you should code up something to format the output as you need.

This is good advice, but the printing behavior of Data nonetheless strikes me as a bug. NSData's printing behavior seems much more useful than Data's. If either of you have a moment, would you be able to file a bug about this?

-Joe

> -Shawn
> 
> On Thu, Sep 22, 2016 at 3:33 PM Robert Nikander via swift-users <swift-users at swift.org> wrote:
> Hi,
> 
> I’ve run into a problem when updating to new Swift in Xcode 8. There was some NSData in a string like this:
> 
>     “ … \(data) … “
> 
> It changed to type `Data`, and the string went from hexadecimal bytes to writing “20 bytes”. I’m doing a quick bug fix app release now. I can’t remember if Xcode auto converted this for me. I thought it did.  ?  Either way… seems like they should behave the same here, no?
> 
> Rob
> 
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users



More information about the swift-users mailing list