mirror of
https://github.com/Instagram/IGListKit
synced 2026-04-25 23:47:18 +00:00
Summary: Introduces a compositional layout example that leverages section controller methods to determine layout. Differential Revision: D71402637 fbshipit-source-id: 1179abf13157fb5cb78c8a9086718d1216fb4276
33 lines
866 B
Swift
33 lines
866 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
|
|
|
|
final class ActivityItem: ListDiffable {
|
|
|
|
let bodyText: String
|
|
let header: String?
|
|
let footer: String?
|
|
|
|
init(bodyText: String, header: String? = nil, footer: String? = nil) {
|
|
self.bodyText = bodyText
|
|
self.header = header
|
|
self.footer = footer
|
|
}
|
|
|
|
// MARK: ListDiffable
|
|
|
|
func diffIdentifier() -> NSObjectProtocol {
|
|
return bodyText as NSObjectProtocol
|
|
}
|
|
|
|
func isEqual(toDiffableObject object: ListDiffable?) -> Bool {
|
|
guard self !== object else { return true }
|
|
guard let object = object as? ActivityItem else { return false }
|
|
return bodyText == object.bodyText
|
|
}
|
|
}
|