[swift-users] Dictionary with optional values

Jens Alfke jens at mooseyard.com
Thu May 19 01:44:15 CDT 2016


> On May 18, 2016, at 7:35 PM, Nathan Day <nathan_day at mac.com> wrote:
> 
> In objective-c I have come across something like this a lot where a NSDictionary has been created from JSON an a NSNull is used to represent an actual null in the source JSON versus the absence of the key

Yeah, this comes from JavaScript, which weirdly has both ‘null’ and ‘undefined’ values; they’re kind of similar but not the same, and the latter is more like what we think of as null/nil in Swift or Obj-C. I think this was a bad design, and unfortunately it crept into JSON, which was based on JavaScript literals.

—Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160518/ae5c0c75/attachment.html>


More information about the swift-users mailing list