Please see

https://github.com/PureSwift/SwiftFoundation/blob/develop/Sources/SwiftFoundation/Null.swift
 
<https://github.com/PureSwift/SwiftFoundation/blob/develop/Sources/SwiftFoundation/Null.swift>

https://github.com/PureSwift/SwiftFoundation/blob/develop/Sources/SwiftFoundation/JSON.swift
 
<https://github.com/PureSwift/SwiftFoundation/blob/develop/Sources/SwiftFoundation/JSON.swift>

Specifically, line 77 in JSON.swift

        Coleman,





> On Jun 23, 2016, at 12:54 AM, David Waite <da...@alkaline-solutions.com> 
> wrote:
> 
> 
>> On Jun 22, 2016, at 10:14 PM, Alsey Miller via swift-evolution 
>> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
>> 
>> Add a struct Null to the Swift 3.0 Foundation value types. As a struct, Null 
>> is more performant (no ARC or memory allocation) than NSNull, and will be 
>> needed for Swift JSON decoders and libraries that want to use struct value 
>> types, and be free from classes for their model layer.
>> 
> I assume you are thinking of [String:SomeRootJSONProtocol] as the Object 
> type? However, once you reference the data as a protocol however, it will be 
> promoted and stored as a reference type.
> 
> I’ve preferred a similar approach to the following for JSON (although this 
> isn’t my code): 
> https://gist.github.com/dorentus/1e2132edfb174028bf11#file-json-swift-L30-L38 
> <https://gist.github.com/dorentus/1e2132edfb174028bf11#file-json-swift-L30-L38>
> 
> -DW

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to