[swift-users] Foundation on Linux `CFBooleanGetTypeID`/`CFGetTypeID`

Jens Alfke jens at mooseyard.com
Tue May 24 14:49:01 CDT 2016


> On May 24, 2016, at 11:03 AM, Tony Parker <anthony.parker at apple.com> wrote:
> 
> Why not use `func boolValue` instead, if you need a true/false answer?

I don’t remember the original code snippet, but there are cases where you need to know what type of number is stored in an NSNumber. An example is encoding to JSON, where a boolean value should be written as “true” or “false”, not “1” or “0”.

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


More information about the swift-users mailing list