More exact code and comments for iOS, tested on simulator.
Merge iOS branch and update readme.