An open API service indexing awesome lists of open source software.

https://github.com/ikesyo/swift-with-previous

A Swift property wrapper which stores the previous value
https://github.com/ikesyo/swift-with-previous

Last synced: over 1 year ago
JSON representation

A Swift property wrapper which stores the previous value

Awesome Lists containing this project

README

          

# swift-with-previous
A Swift property wrapper which stores the previous value. The previous value can be get by the projected value `$propertyName`.

```swift
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](LICENSE) for details.