IGListKit/Examples/Examples-iOS/IGListKitExamples/Views/MonthTitleCell.swift
Nate Stedman 1a44045dce Run lint on IGListKit
Differential Revision: D19141253

fbshipit-source-id: 9ed4c278a91bb48a1f6d33cafa9ce8f21861573d
2019-12-19 09:34:42 -08:00

46 lines
1.1 KiB
Swift

/*
* Copyright (c) Facebook, Inc. and its 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
import UIKit
final class MonthTitleCell: UICollectionViewCell {
fileprivate lazy var label: UILabel = {
let view = UILabel()
view.backgroundColor = .clear
view.textAlignment = .center
view.textColor = UIColor(white: 0.7, alpha: 1)
view.font = .boldSystemFont(ofSize: 13)
self.contentView.addSubview(view)
return view
}()
var text: String? {
get {
return label.text
}
set {
label.text = newValue
}
}
override func layoutSubviews() {
super.layoutSubviews()
label.frame = contentView.bounds
}
}
extension MonthTitleCell: ListBindable {
func bindViewModel(_ viewModel: Any) {
guard let viewModel = viewModel as? MonthTitleViewModel else { return }
label.text = viewModel.name.uppercased()
}
}