[swift-users] Swift 3.1 String(

Jon Shier jon at jonshier.com
Wed Apr 5 09:37:00 CDT 2017


	This was something that sounded like a good change but is extremely annoying in use. Once I get time I’m going to try writing an extension on Optional that generates a logDescription property so I don’t have to use that awful String(describing:) API.



Jon Shier


> On Apr 5, 2017, at 10:35 AM, Shawn Erickson via swift-users <swift-users at swift.org> wrote:
> 
> Avoid using optionals in string interpolation or make it explicit as the fix-it suggests.
> 
> On Wed, Apr 5, 2017 at 7:27 AM Maxim Veksler via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
> Hi,
> 
> Swift 3.1 compiler seems to introduces a new complier warning regarding String(describing: )
> 
> So this line:
> Log.info("Update name for user \(fbUser)")
> 
> Produces the warning: "note: use 'String(describing:)' to silence this warning"
> 
> and becomes this line
> Log.info("Update name for user \(String(describing: fbUser))")
> 
> This new syntax is not very sexy, especially for logging. Any suggestions, possibility on the API end of Log to make this warning go away? or write it differently.
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org <mailto:swift-users at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users <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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170405/630664e9/attachment.html>


More information about the swift-users mailing list