diff options
author | Eric Kuck <eric@bluelinelabs.com> | 2018-12-14 17:12:59 -0600 |
---|---|---|
committer | Eric Kuck <eric@bluelinelabs.com> | 2018-12-14 17:15:22 -0600 |
commit | 7a24f18eb753180800f9b44a767b0d59e4e702b7 (patch) | |
tree | 0e02b3ff59a672b0b25eb7bcc195e23730abec40 /WireGuard/WireGuard/UI/iOS/TunnelDetail/TunnelDetailKeyValueCell.swift | |
parent | Prettier log time format (diff) | |
download | wireguard-apple-7a24f18eb753180800f9b44a767b0d59e4e702b7.tar.xz wireguard-apple-7a24f18eb753180800f9b44a767b0d59e4e702b7.zip |
Most similar views now shared between ViewControllers
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/SharedViews/KeyValueCell.swift (renamed from WireGuard/WireGuard/UI/iOS/TunnelDetail/TunnelDetailKeyValueCell.swift) | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelDetail/TunnelDetailKeyValueCell.swift b/WireGuard/WireGuard/UI/iOS/SharedViews/KeyValueCell.swift index cbe1c14..78026ea 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelDetail/TunnelDetailKeyValueCell.swift +++ b/WireGuard/WireGuard/UI/iOS/SharedViews/KeyValueCell.swift @@ -3,7 +3,7 @@ import UIKit -class TunnelDetailKeyValueCell: CopyableLabelTableViewCell { +class KeyValueCell: CopyableLabelTableViewCell { var key: String { get { return keyLabel.text ?? "" } set(value) { keyLabel.text = value } @@ -14,7 +14,7 @@ class TunnelDetailKeyValueCell: CopyableLabelTableViewCell { } override var textToCopy: String? { - return self.valueLabel.text + return valueLabel.text } let keyLabel: UILabel = { @@ -46,14 +46,14 @@ class TunnelDetailKeyValueCell: CopyableLabelTableViewCell { NSLayoutConstraint.activate([ keyLabel.leftAnchor.constraint(equalTo: contentView.layoutMarginsGuide.leftAnchor), keyLabel.topAnchor.constraint(equalToSystemSpacingBelow: contentView.layoutMarginsGuide.topAnchor, multiplier: 0.5) - ]) + ]) contentView.addSubview(valueLabel) valueLabel.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ valueLabel.rightAnchor.constraint(equalTo: contentView.layoutMarginsGuide.rightAnchor), contentView.layoutMarginsGuide.bottomAnchor.constraint(equalToSystemSpacingBelow: valueLabel.bottomAnchor, multiplier: 0.5) - ]) + ]) keyLabel.setContentCompressionResistancePriority(.defaultHigh + 1, for: .horizontal) keyLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal) @@ -64,7 +64,7 @@ class TunnelDetailKeyValueCell: CopyableLabelTableViewCell { func configureForContentSize() { var constraints = [NSLayoutConstraint]() - if self.traitCollection.preferredContentSizeCategory.isAccessibilityCategory { + if traitCollection.preferredContentSizeCategory.isAccessibilityCategory { // Stack vertically if !isStackedVertically { constraints = [ @@ -88,9 +88,9 @@ class TunnelDetailKeyValueCell: CopyableLabelTableViewCell { } } if !constraints.isEmpty { - NSLayoutConstraint.deactivate(self.contentSizeBasedConstraints) + NSLayoutConstraint.deactivate(contentSizeBasedConstraints) NSLayoutConstraint.activate(constraints) - self.contentSizeBasedConstraints = constraints + contentSizeBasedConstraints = constraints } } |