Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does NSNumberFormatter.stringFromNumber ever return nil?

It seems to me that any valid number can also be expressed as a String, so I don't know why this function returns a String? instead of a String.

like image 930
m81 Avatar asked Jan 23 '15 04:01

m81


1 Answers

My best guess would be because of the legacy support. This is from the official documentation:

The behavior of an NSNumberFormatter object can conform either to the range of behaviors existing prior to OS X v10.4 or to the range of behavior since that release. NSNumberFormatter Class Reference

like image 95
tf.alves Avatar answered Oct 20 '22 15:10

tf.alves