Skip to content

Instantly share code, notes, and snippets.

@bitbreakr
Last active October 25, 2019 08:52
Show Gist options
  • Save bitbreakr/c281013dc16ea53d70d072edb2663b84 to your computer and use it in GitHub Desktop.
Save bitbreakr/c281013dc16ea53d70d072edb2663b84 to your computer and use it in GitHub Desktop.
Swift: Int incrementation
//
// Int.swift
//
// Created by Yan Philippe on 4/22/19.
// Copyright © 2019 Yan Philippe. All rights reserved.
//
import Foundation
extension Int {
mutating func increment(with value: Int = 1) -> Void {
self = self + value
}
mutating func decrement(with value: Int = 1) -> Void {
self = self - value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment