From 7a24f18eb753180800f9b44a767b0d59e4e702b7 Mon Sep 17 00:00:00 2001 From: Eric Kuck Date: Fri, 14 Dec 2018 17:12:59 -0600 Subject: Most similar views now shared between ViewControllers Signed-off-by: Eric Kuck --- .../UI/iOS/SharedViews/CheckmarkCell.swift | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 WireGuard/WireGuard/UI/iOS/SharedViews/CheckmarkCell.swift (limited to 'WireGuard/WireGuard/UI/iOS/SharedViews/CheckmarkCell.swift') diff --git a/WireGuard/WireGuard/UI/iOS/SharedViews/CheckmarkCell.swift b/WireGuard/WireGuard/UI/iOS/SharedViews/CheckmarkCell.swift new file mode 100644 index 0000000..db4b6c9 --- /dev/null +++ b/WireGuard/WireGuard/UI/iOS/SharedViews/CheckmarkCell.swift @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2018 WireGuard LLC. All Rights Reserved. + +import UIKit + +class CheckmarkCell: UITableViewCell { + var message: String { + get { return textLabel?.text ?? "" } + set(value) { textLabel!.text = value } + } + var isChecked: Bool { + didSet { + accessoryType = isChecked ? .checkmark : .none + } + } + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + isChecked = false + super.init(style: .default, reuseIdentifier: reuseIdentifier) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func prepareForReuse() { + super.prepareForReuse() + message = "" + isChecked = false + } +} -- cgit v1.2.3-59-g8ed1b