diff options
Diffstat (limited to 'Sources/WireGuardApp/UI/iOS/View/TextCell.swift')
-rw-r--r-- | Sources/WireGuardApp/UI/iOS/View/TextCell.swift | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Sources/WireGuardApp/UI/iOS/View/TextCell.swift b/Sources/WireGuardApp/UI/iOS/View/TextCell.swift new file mode 100644 index 0000000..3024b46 --- /dev/null +++ b/Sources/WireGuardApp/UI/iOS/View/TextCell.swift @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved. + +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") + } + + func setTextColor(_ color: UIColor) { + textLabel?.textColor = color + } + + func setTextAlignment(_ alignment: NSTextAlignment) { + textLabel?.textAlignment = alignment + } + + override func prepareForReuse() { + super.prepareForReuse() + message = "" + setTextColor(.label) + setTextAlignment(.left) + } +} |