From 7b9d4cb9e35a88f13face71543ce4773102fe224 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 21 Dec 2018 23:34:56 +0100 Subject: Nuke trailing spaces Signed-off-by: Jason A. Donenfeld --- .../WireGuard/UI/iOS/View/TunnelListCell.swift | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift') diff --git a/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift b/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift index d13346a..2965476 100644 --- a/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift +++ b/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift @@ -19,7 +19,7 @@ class TunnelListCell: UITableViewCell { } } var onSwitchToggled: ((Bool) -> Void)? - + let nameLabel: UILabel = { let nameLabel = UILabel() nameLabel.font = UIFont.preferredFont(forTextStyle: .body) @@ -27,35 +27,35 @@ class TunnelListCell: UITableViewCell { nameLabel.numberOfLines = 0 return nameLabel }() - + let busyIndicator: UIActivityIndicatorView = { let busyIndicator = UIActivityIndicatorView(style: .gray) busyIndicator.hidesWhenStopped = true return busyIndicator }() - + let statusSwitch = UISwitch() - + private var statusObservationToken: AnyObject? private var nameObservationToken: AnyObject? - + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) - + contentView.addSubview(statusSwitch) statusSwitch.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ statusSwitch.centerYAnchor.constraint(equalTo: contentView.centerYAnchor), contentView.rightAnchor.constraint(equalTo: statusSwitch.rightAnchor) ]) - + contentView.addSubview(busyIndicator) busyIndicator.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ busyIndicator.centerYAnchor.constraint(equalTo: contentView.centerYAnchor), statusSwitch.leftAnchor.constraint(equalToSystemSpacingAfter: busyIndicator.rightAnchor, multiplier: 1) ]) - + contentView.addSubview(nameLabel) nameLabel.translatesAutoresizingMaskIntoConstraints = false nameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) @@ -67,16 +67,16 @@ class TunnelListCell: UITableViewCell { busyIndicator.leftAnchor.constraint(equalToSystemSpacingAfter: nameLabel.rightAnchor, multiplier: 1), bottomAnchorConstraint ]) - + accessoryType = .disclosureIndicator - + statusSwitch.addTarget(self, action: #selector(switchToggled), for: .valueChanged) } - + @objc func switchToggled() { onSwitchToggled?(statusSwitch.isOn) } - + private func update(from status: TunnelStatus?) { guard let status = status else { reset() @@ -93,17 +93,17 @@ class TunnelListCell: UITableViewCell { } } } - + required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } - + private func reset() { statusSwitch.isOn = false statusSwitch.isUserInteractionEnabled = false busyIndicator.stopAnimating() } - + override func prepareForReuse() { super.prepareForReuse() reset() -- cgit v1.2.3-59-g8ed1b