Project Euler, Challenge #17 in Swift
I find it confusing that you first assign an empty string and then append to it. I suggest returning directly, like

// var words:String = "" Delete this

if number &gt;= 0 &amp;&amp; number &lt;= 19 {

    return unitNames[number]


And a return for each branch. When I see a return I can rest my mind that the function has ended, if I see a string appending, maybe it will grow more before being returned.



The line:

 let end = NSDate();


Inside Euler17 should be deleted as it is useless.



Euler17 can be simplified a lot.

return (1...1000).map{count(convertIntegerToWords($0)}.sum


Use functional programming where it is worth it.



 var digits = number.array


Should be at the start of the function as you repeat it in almost every branch.



About @jimbo 's comment:


  For speed, I'd put the &gt;= 100 &amp;&amp; number &lt;= 999 as the first > if, because 899 times out of 999, that'll be the one that's hit, > > and you don't want that being the last one.


Do not do it. Readibility will decrease and the performance impact will likely be minimal (benchmark needed).