Lic - easy, safe object slicing for Swift
Lic is a μ-framework that makes getting slices of arrays and strings in Swift 2 safe and easy:
[0,1,2,3][1, -1] // => ArraySlice([1, 2])
"Hello"[-1000, nil] // => "Hello"
[1,2,3,4,5,6,7,8][1,5][2,3] // => ArraySlice([4])
Lic has no dependencies, not even Foundation
.
To make a slice, you must give two indexes, indicating the start and end positions where the slice will be produced. Lic tries to make sense of the indexes following these rules:
nil
is equivalent to the start or end indexWhen it comes to slicing, your ranges are always safe and accepted.
github "dduan/Lic"
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'Lic'
end
Include the single source file in your project.
(There's no dependencies at all).
It's "slice"[1,-1]
- a slice of the word "slice", you know, what Lic produces.
BSD, see LICENSE