Subscripting an array with a range doesn’t return an array, but a slice. You can create an array out of that slice though.
var tags = ["this", "is", "cool"]
tags[1..<3]
var someTags: Slice<String> = tags[1..<3]
var someTagsArray: [String] = Array(someTags)
More Related Contents:
- Speed up fetching posts for my social network app by using query instead of observing a single event repeatedly
- How To Download Multiple Files Sequentially using NSURLSession downloadTask in Swift
- UIImageView – How to get the file name of the image assigned?
- Check for internet connection availability in Swift
- Detect current device with UI_USER_INTERFACE_IDIOM() in Swift
- Swift 4 “This class is not key value coding compliant”
- How to use iOS (Swift) SceneKit SCNSceneRenderer unprojectPoint properly
- NSURLConnection Using iOS Swift
- ViewDidAppear is not called when opening app from background
- Xcode NSManagedObject subclass contains optionals when they are marked as non-optional
- Swift programmatically navigate to another view controller/scene
- Working with C APIs from Swift
- Multiple UILabels inside a self sizing UITableViewCell
- Force landscape mode in one ViewController using Swift
- what does Error “Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)” mean?
- SWIFT – BLE communications
- SwiftUI: What is @AppStorage property wrapper
- How to add a button to the MKPointAnnotation?
- iOS 13.1 Crash in AVAudio Player
- Swift – How to hide back button in navigation item?
- Swift performSelector:withObject:afterDelay: is unavailable [duplicate]
- When can I activate/deactivate layout constraints?
- Pass Parameter in WebService in Swift
- Uncaught exception: This class is not key value coding-compliant [duplicate]
- Could not find a valid GoogleService-Info.plist in your project
- Swift Modal View Controller with transparent background [duplicate]
- Xcode 8 / Swift 3: “Expression of type UIViewController? is unused” warning
- Is there any way to add UIPickerView into UIAlertController (Alert or ActionSheet) in Swift?
- Swift + CoreData: Cannot Automatically Set Optional Attribute On Generated NSManagedObject Subclass
- swift invalidate timer doesn’t work