[swift-users] Why this string not work. Any and Optionals in dictionary

Adrian Zubarev adrian.zubarev at devandartist.com
Mon Jan 23 05:08:28 CST 2017


There is no universal `nil`. `nil` is typed. That said think of `nil` as a shorthand form for `Optional<YourType>.none`

--  
Adrian Zubarev
Sent with Airmail  

Am 23. Januar 2017 um 11:24:18, Седых Александр via swift-users (swift-users at swift.org(mailto:swift-users at swift.org)) schrieb:

>  
> Hello.
> I have a simple expression with Any and is not work. Why?
>  
>  
> var dictarray: [[String: Any]] = [["kek": nil]]  
>  
> \\ Nil is not compatible with expected dictionary value type 'Any'
>  
>  
>  
>  
>  
>  
> --
>  
> And in other hand this is work
>  
>  
> var dictarray: [[String: Any]] = [[:]] \\ [[:]], dictarray.count = 1
>  
>  
>  
>  
> Седых Александр _______________________________________________
> 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/20170123/b20ecaf2/attachment.html>


More information about the swift-users mailing list