Quantcast
Viewing all articles
Browse latest Browse all 4

Answer by Martin R for Swift casts Bool to NSNumber using 'as' operator

From Working with Cocoa Frameworks (emphasis added):

Numbers

Swift bridges between the NSNumber class and Swift numeric types, including Int, Double, and Bool.

You can create an NSNumber object by casting a Swift number value using the as operator. Because NSNumber can contain a variety of different types, you must use the as? operator when casting to a Swift number type.


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>