Swift: Five excellent undocumented functions

Try ’em out and then submit feature request radars to un-un-doc them.

1. Simple string splits.

Supply a single character, and either decompose or split off the first item.


2. The power of love. Or two. If two is love.

This is such an aesthetically nice little function.


3. Calculate and round log 2

log2(31) is 4.954196310386875. Isn’t this better than flooring and rinting?


4. Cast your types upon the water.

Sometimes NSStrings deserve to be postfixed.


5. Leading to what?

I could really have used this functionality a couple of weeks ago, ended up writing my own version. Unfortunately, this works only for Ints and not for, say, Int8.


Comments are closed.