IGListKit/Examples/Examples-iOS/IGListKitExamples/Models/ActivityItem.swift
Krys Jurgowski 15b45d0d80 Example using SwiftUI with compositional layout
Summary: Introduces a compositional layout example that leverages section controller methods to determine layout.

Differential Revision: D71402637

fbshipit-source-id: 1179abf13157fb5cb78c8a9086718d1216fb4276
2025-03-19 10:14:23 -07:00

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