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)
}
}
MIT license. See LICENSE for details.
link |
Stars: 3 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics