2021-06-28 19:41:41 +08:00
//
2022-10-10 19:14:52 +08:00
// C o m p o s e R e p l y T o T a b l e V i e w C e l l . s w i f t
2021-06-28 19:41:41 +08:00
// M a s t o d o n
//
// C r e a t e d b y M a i n a s u K C i r n o o n 2 0 2 1 - 6 - 2 8 .
//
import UIKit
import Combine
2022-10-10 19:14:52 +08:00
final class ComposeReplyToTableViewCell : UITableViewCell {
2021-06-28 19:41:41 +08:00
var disposeBag = Set < AnyCancellable > ( )
2022-01-27 21:23:39 +08:00
let statusView = StatusView ( )
2021-06-28 19:41:41 +08:00
2022-10-10 19:14:52 +08:00
@ Published var framePublisher : CGRect = . zero
2021-06-28 19:41:41 +08:00
override func prepareForReuse ( ) {
super . prepareForReuse ( )
disposeBag . removeAll ( )
2022-01-27 21:23:39 +08:00
statusView . prepareForReuse ( )
2021-06-28 19:41:41 +08:00
}
override init ( style : UITableViewCell . CellStyle , reuseIdentifier : String ? ) {
super . init ( style : style , reuseIdentifier : reuseIdentifier )
_init ( )
}
required init ? ( coder : NSCoder ) {
super . init ( coder : coder )
_init ( )
}
override func layoutSubviews ( ) {
super . layoutSubviews ( )
2022-10-10 19:14:52 +08:00
framePublisher = bounds
2021-06-28 19:41:41 +08:00
}
}
2022-10-10 19:14:52 +08:00
extension ComposeReplyToTableViewCell {
2021-06-28 19:41:41 +08:00
private func _init ( ) {
2021-06-29 16:41:58 +08:00
selectionStyle = . none
2021-06-28 19:41:41 +08:00
backgroundColor = . clear
statusView . translatesAutoresizingMaskIntoConstraints = false
contentView . addSubview ( statusView )
NSLayoutConstraint . activate ( [
statusView . topAnchor . constraint ( equalTo : contentView . topAnchor , constant : 20 ) . identifier ( " statusView.top to ComposeRepliedToStatusContentCollectionViewCell.contentView.top " ) ,
2022-01-27 21:23:39 +08:00
statusView . leadingAnchor . constraint ( equalTo : contentView . leadingAnchor ) ,
contentView . trailingAnchor . constraint ( equalTo : statusView . trailingAnchor ) ,
2021-06-28 19:41:41 +08:00
contentView . bottomAnchor . constraint ( equalTo : statusView . bottomAnchor , constant : 10 ) . identifier ( " ComposeRepliedToStatusContentCollectionViewCell.contentView.bottom to statusView.bottom " ) ,
] )
2022-01-27 21:23:39 +08:00
statusView . setup ( style : . composeStatusReplica )
2021-06-28 19:41:41 +08:00
}
}