Skip to content

Instantly share code, notes, and snippets.

@yukin01
Created March 4, 2019 10:18
Show Gist options
  • Save yukin01/0092bac72d162ae4e86d15c6b53de5ec to your computer and use it in GitHub Desktop.
Save yukin01/0092bac72d162ae4e86d15c6b53de5ec to your computer and use it in GitHub Desktop.
RxDataSources+SingleSectionModel
import Foundation
import Differentiator
struct SingleSectionModel<ItemType: Equatable> {
var items: [ItemType]
init(items: [ItemType]) {
self.items = items
}
}
extension SingleSectionModel: SectionModelType {
init(original: SingleSectionModel<ItemType>, items: [ItemType]) {
self.items = items
}
typealias Item = ItemType
}
extension SingleSectionModel: Equatable {
static func == (lhs: SingleSectionModel<ItemType>, rhs: SingleSectionModel<ItemType>) -> Bool {
return lhs.items == rhs.items
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment