Kurdtvs-Live-Kurdish-TV-Kur.../Mastodon/Scene/Root/Sidebar/View/SidebarListCollectionViewCe...

60 lines
1.4 KiB
Swift
Raw Normal View History

2021-09-24 13:58:50 +02:00
//
// SidebarListTableViewCell.swift
// Mastodon
//
// Created by Cirno MainasuK on 2021-9-24.
//
import UIKit
import Combine
2021-09-24 13:58:50 +02:00
final class SidebarListCollectionViewCell: UICollectionViewListCell {
var disposeBag = Set<AnyCancellable>()
2021-09-24 13:58:50 +02:00
var item: SidebarListContentView.Item?
var _contentView: SidebarListContentView? {
guard let view = contentView as? SidebarListContentView else {
assertionFailure()
return nil
}
return view
}
override func prepareForReuse() {
super.prepareForReuse()
disposeBag.removeAll()
}
2021-09-24 13:58:50 +02:00
override init(frame: CGRect) {
super.init(frame: frame)
_init()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
_init()
}
}
extension SidebarListCollectionViewCell {
private func _init() {
}
override func updateConfiguration(using state: UICellConfigurationState) {
var newConfiguration = SidebarListContentView.ContentConfiguration().updated(for: state)
newConfiguration.item = item
contentConfiguration = newConfiguration
2021-10-29 08:58:09 +02:00
// remove background
2021-09-24 13:58:50 +02:00
var newBackgroundConfiguration = UIBackgroundConfiguration.listSidebarCell().updated(for: state)
2021-10-29 08:58:09 +02:00
newBackgroundConfiguration.backgroundColor = .clear
2021-09-24 13:58:50 +02:00
backgroundConfiguration = newBackgroundConfiguration
}
}