Latest 0.1.2
Homepage https://github.com/dduan/Lic
License MIT
Platforms ios 8.0, osx 10.10
Authors

Lic – easy, safe object slicing for Swift

Summary

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.

Range Free Slices

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:

  • a negative index indicates a position counted in the reverse direction
  • nil is equivalent to the start or end index
  • an out-of-bound index is treated as the same as start or end index, depending on which bound it goes beyond
  • if the start index ends up at a position after the end index, Lic returns the empty value

When it comes to slicing, your ranges are always safe and accepted.

Install

Carthage

github "dduan/Lic"

CocoaPods

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
  pod 'Lic'
end

Source File

Include the single source file in your project.

(There’s no dependencies at all).

What kind of name is "Lic"?

It’s "slice"[1,-1] – a slice of the word "slice", you know, what Lic produces.

License

BSD, see LICENSE

Latest podspec

{
    "name": "Lic",
    "version": "0.1.2",
    "summary": "Easy, safe object slicing for Swift",
    "description": "Lic is a u03bc-framework that makes getting slices of arraysnand strings in Swift 2 safe and easy.",
    "homepage": "https://github.com/dduan/Lic",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "Daniel Duan": "[email protected]"
    },
    "social_media_url": "https://twitter.com/Daniel_Duan",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "source": {
        "git": "https://github.com/dduan/Lic.git",
        "tag": "v0.1.2"
    },
    "source_files": [
        "Lic",
        "Lic/**/*.{swift}"
    ]
}

Pin It on Pinterest

Share This