Swiftpack.co - ikesyo/swift-with-previous as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ikesyo.
ikesyo/swift-with-previous 1.0.0
A Swift property wrapper which stores the previous value
⭐️ 3
🕓 2 years ago
.package(url: "https://github.com/ikesyo/swift-with-previous.git", from: "1.0.0")

swift-with-previous

A Swift property wrapper which stores the previous value. The previous value can be get by the projected value $propertyName.

import XCTest
import WithPrevious

final class WithPreviousTests: XCTestCase {
    @WithPrevious var value = 0

    func testWithPreviousWrapper() {
        XCTAssertEqual(value, 0)
        XCTAssertNil($value)

        value = 10

        XCTAssertEqual(value, 10)
        XCTAssertEqual($value, 0)
    }
}

License

MIT license. See LICENSE for details.

GitHub

link
Stars: 3
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.0.0
2 years ago
  • Initial release

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics