diff options
author | 2018-12-21 23:34:56 +0100 | |
---|---|---|
committer | 2018-12-21 23:34:56 +0100 | |
commit | 7b9d4cb9e35a88f13face71543ce4773102fe224 (patch) | |
tree | 90810e67570a1bd2b520f352b50117925d3b1fab /WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift | |
parent | providerConfiguration is now a WgQuickConfig (diff) | |
download | wireguard-apple-7b9d4cb9e35a88f13face71543ce4773102fe224.tar.xz wireguard-apple-7b9d4cb9e35a88f13face71543ce4773102fe224.zip |
Nuke trailing spaces
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift | 30 |
1 files changed, 15 insertions, 15 deletions
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() |