https://github.com/linxunfeng/swiftytraceablevalue
优雅的可比较类型
https://github.com/linxunfeng/swiftytraceablevalue
Last synced: about 1 year ago
JSON representation
优雅的可比较类型
- Host: GitHub
- URL: https://github.com/linxunfeng/swiftytraceablevalue
- Owner: LinXunFeng
- Created: 2021-12-07T14:00:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-09T01:06:56.000Z (over 4 years ago)
- Last Synced: 2025-02-02T07:44:52.188Z (over 1 year ago)
- Language: Swift
- Homepage:
- Size: 30.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SwiftyTraceableValue

[](https://travis-ci.org/LinXunFeng/SwiftyTraceableValue)
[](https://cocoapods.org/pods/SwiftyTraceableValue)
[](https://cocoapods.org/pods/SwiftyTraceableValue)
[](https://cocoapods.org/pods/SwiftyTraceableValue)

## Article
掘金:[ReactorKit + RxDataSources 列表多次刷新的解决方案](https://juejin.cn/post/7039367289170296863)
## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
- iOS 9.0+
- Xcode 11+
- Swift 5+
## Installation
SwiftyTraceableValue is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'SwiftyTraceableValue'
```
## Usage
1、使用属性包装器 `SwiftyTraceableValue` 对需要比较属性进行修饰
```swift
// Reactor
struct State {
@SwiftyTraceableValue var sections : [LXFSection] = []
...
}
```
2、使用 `mapDistinctUntilTraceableValueChanged` 方法,并在对应属性前加上 `$`
```swift
// View
reactor.state.mapDistinctUntilTraceableValueChanged { $0.$sections }
.bind(to: tableView.rx.items(dataSource: dataSource))
.disposed(by: disposeBag)
```
## License
SwiftyTraceableValue is available under the MIT license. See the LICENSE file for more info.
## Author
- LinXunFeng
- email: [linxunfeng@yeah.net](mailto:linxunfeng@yeah.net)
- Blogs: [全栈行动](https://fullstackaction.com/) | [LinXunFeng‘s Blog](http://linxunfeng.top/) | [掘金](https://juejin.im/user/58f8065e61ff4b006646c72d/posts)

## Other
|
|
|
| :----------------------------------------------------------: | :----------------------------------------------------------: |
| | |