Xcode Test for iOS v3.1.0

#181 Step refactor in order to make it unit-testable, no change on the public API.