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

https://github.com/linxunfeng/swiftytraceablevalue

优雅的可比较类型
https://github.com/linxunfeng/swiftytraceablevalue

Last synced: about 1 year ago
JSON representation

优雅的可比较类型

Awesome Lists containing this project

README

          

# SwiftyTraceableValue

![Author](https://img.shields.io/badge/author-LinXunFeng-blue.svg?style=flat-square)
[![CI Status](https://img.shields.io/travis/LinXunFeng/SwiftyTraceableValue.svg?style=flat)](https://travis-ci.org/LinXunFeng/SwiftyTraceableValue)
[![Version](https://img.shields.io/cocoapods/v/SwiftyTraceableValue.svg?style=flat)](https://cocoapods.org/pods/SwiftyTraceableValue)
[![License](https://img.shields.io/cocoapods/l/SwiftyTraceableValue.svg?style=flat)](https://cocoapods.org/pods/SwiftyTraceableValue)
[![Platform](https://img.shields.io/cocoapods/p/SwiftyTraceableValue.svg?style=flat)](https://cocoapods.org/pods/SwiftyTraceableValue)
![visitors](https://visitor-badge.glitch.me/badge?page_id=LinXunFeng.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

| | |
| :----------------------------------------------------------: | :----------------------------------------------------------: |
| | |