IGListKit/Examples/Examples-iOS/IGListKitExamples/Models/HorizontalCardsSection.swift
Maxime Ollivier 309e1d7e2b add horizontal row to UICollectionViewCompositionalLayout example
Summary: Lets go even beyond the `MixedDataViewController` example by taking advantage of `orthogonalScrollingBehavior`. Really neat!

Differential Revision: D52260531

fbshipit-source-id: aee8b38a38284104fa65ba8d33426a9e6216e503
2023-12-19 07:17:30 -08:00

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)
}
}