Check out example codes for "swift from 1 to 01". It will help you in understanding the concepts better.

Code Example 1

import Foundation

for myInt in 1 ... 3 {
    print(String(format: "%02d", myInt))
}

Learn ReactJs, React Native from akashmittal.com