Latest 1.0.0
Homepage https://github.com/jeden/swiftplusplus
License MIT
Platforms ios 8.0, osx 10.11, watchos 2.0, tvos 9.0

SwiftPlusPlus simply brings the pre and post increment and decrement operators back to Swift 3, so that you can write this again:

var index: Int

index++
++index

--index
index--

Note that it works as a standalone statement, without returning the variable value before or after the increment/decrement. So do NOT expect to use it in code like:

if index++ { 
    ...
}

That’s just a personal choice – I think that usage may introduce subtle bugs, so I have never used, nor I use in C++ or other languages where these operators are available.

However, I love the operator when used standalone. Maybe for historical reasons, as it’s the first thing I learned and loved in C, long long ago.

Installation

Manual

Just copy the SwiftPlusPlus.swift file into your Xcode project

Cocoapods

pod 'SwiftPlusPlus'

Carthage

N/A yet

Swift Package Manager

N/A yet

Usage

Manual installation

In case of manual installation, the operators can be used anywhere in the code without any import.

Cocoapods

Using cocoapods instead you need to add import spp in each file where the operators are used.

Carthage

N/A yet

Swift Package Manager

N/A yet

License

MIT
Read the LICENSE file

Latest podspec

{
    "name": "SwiftPlusPlus",
    "version": "1.0.0",
    "summary": "The ++ and -- operators, back to Swift",
    "description": "The pre and post increment/decrement, removed from Swift 3",
    "homepage": "https://github.com/jeden/swiftplusplus",
    "license": {
        "type": "MIT"
    },
    "authors": "Antonio Bello",
    "module_name": "spp",
    "platforms": {
        "ios": "8.0",
        "osx": "10.11",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/jeden/swiftplusplus.git",
        "tag": "1.0.0"
    },
    "source_files": "sources/**/*.swift",
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This