2019-02-27 08:00:57 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2021-06-17 14:56:46 +00:00
|
|
|
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
|
2019-02-27 08:00:57 +00:00
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
class TextCell: UITableViewCell {
|
|
|
|
var message: String {
|
|
|
|
get { return textLabel?.text ?? "" }
|
|
|
|
set(value) { textLabel!.text = value }
|
|
|
|
}
|
|
|
|
|
|
|
|
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
|
|
|
super.init(style: .default, reuseIdentifier: reuseIdentifier)
|
|
|
|
}
|
|
|
|
|
|
|
|
required init?(coder aDecoder: NSCoder) {
|
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
|
}
|
|
|
|
|
2019-03-09 04:17:35 +00:00
|
|
|
func setTextColor(_ color: UIColor) {
|
|
|
|
textLabel?.textColor = color
|
|
|
|
}
|
|
|
|
|
|
|
|
func setTextAlignment(_ alignment: NSTextAlignment) {
|
|
|
|
textLabel?.textAlignment = alignment
|
|
|
|
}
|
|
|
|
|
2019-02-27 08:00:57 +00:00
|
|
|
override func prepareForReuse() {
|
|
|
|
super.prepareForReuse()
|
|
|
|
message = ""
|
2019-10-14 21:43:56 +00:00
|
|
|
if #available(iOS 13.0, *) {
|
|
|
|
setTextColor(.label)
|
|
|
|
} else {
|
|
|
|
setTextColor(.black)
|
|
|
|
}
|
2019-03-09 04:17:35 +00:00
|
|
|
setTextAlignment(.left)
|
2019-02-27 08:00:57 +00:00
|
|
|
}
|
|
|
|
}
|