How To Create Range in Swift?
In Objective-c we create range by using NSRange NSRange range; So how to create range in Swift? Updated for Swift 4 Swift ranges are more complex than NSRange , and they didn't get any easier in Swift 3. If you want to try to understand the reasoning behind some of this complexity, read this and this . I'll just show you how to create them and when you might use them. Closed Ranges: a...b This range operator creates a Swift range which includes both element a and element b , even if b is the maximum possible value for a type (like Int.max ). There are two different types of closed ranges: