mirror of
https://github.com/Instagram/IGListKit
synced 2026-04-25 23:47:18 +00:00
Summary: Lets go even beyond the `MixedDataViewController` example by taking advantage of `orthogonalScrollingBehavior`. Really neat! Differential Revision: D52260531 fbshipit-source-id: aee8b38a38284104fa65ba8d33426a9e6216e503
39 lines
871 B
Swift
39 lines
871 B
Swift
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import IGListKit
|
|
import Foundation
|
|
|
|
final class HorizontalCardsSection: NSObject {
|
|
|
|
let cardCount: Int
|
|
private(set) var items: [String] = []
|
|
|
|
init(cardCount: Int) {
|
|
self.cardCount = cardCount
|
|
super.init()
|
|
self.items = computeItems()
|
|
}
|
|
|
|
private func computeItems() -> [String] {
|
|
return [Int](1...cardCount).map {
|
|
String(describing: $0)
|
|
}
|
|
}
|
|
}
|
|
|
|
extension HorizontalCardsSection: ListDiffable {
|
|
|
|
func diffIdentifier() -> NSObjectProtocol {
|
|
return self
|
|
}
|
|
|
|
func isEqual(toDiffableObject object: ListDiffable?) -> Bool {
|
|
return self === object ? true : self.isEqual(object)
|
|
}
|
|
|
|
}
|