1
0
mirror of https://github.com/metabolist/metatext synced 2025-01-18 21:09:49 +01:00
metatext-app-ios-iphone-ipad/Extensions/CollectionItem+Extensions.swift
2021-01-18 17:49:38 -08:00

42 lines
1.2 KiB
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import UIKit
import ViewModels
extension CollectionItem {
static let cellClasses = [
StatusListCell.self,
AccountListCell.self,
LoadMoreCell.self,
NotificationListCell.self,
ConversationListCell.self]
var cellClass: AnyClass {
switch self {
case .status:
return StatusListCell.self
case .account:
return AccountListCell.self
case .loadMore:
return LoadMoreCell.self
case let .notification(_, statusConfiguration):
return statusConfiguration == nil ? NotificationListCell.self : StatusListCell.self
case .conversation:
return ConversationListCell.self
}
}
func estimatedHeight(width: CGFloat, identification: Identification) -> CGFloat {
switch self {
case let .status(status, configuration):
return StatusView.estimatedHeight(
width: width,
identification: identification,
status: status,
configuration: configuration)
default:
return UITableView.automaticDimension
}
}
}