aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/EditTunnel/TunnelEditReadOnlyKeyValueCell.swift
diff options
context:
space:
mode:
authorEric Kuck <eric@bluelinelabs.com>2018-12-14 17:12:59 -0600
committerEric Kuck <eric@bluelinelabs.com>2018-12-14 17:15:22 -0600
commit7a24f18eb753180800f9b44a767b0d59e4e702b7 (patch)
tree0e02b3ff59a672b0b25eb7bcc195e23730abec40 /WireGuard/WireGuard/UI/iOS/EditTunnel/TunnelEditReadOnlyKeyValueCell.swift
parentPrettier log time format (diff)
downloadwireguard-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 'WireGuard/WireGuard/UI/iOS/EditTunnel/TunnelEditReadOnlyKeyValueCell.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/EditTunnel/TunnelEditReadOnlyKeyValueCell.swift35
1 files changed, 19 insertions, 16 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/EditTunnel/TunnelEditReadOnlyKeyValueCell.swift b/WireGuard/WireGuard/UI/iOS/EditTunnel/TunnelEditReadOnlyKeyValueCell.swift
index 48c8798..15d58d6 100644
--- a/WireGuard/WireGuard/UI/iOS/EditTunnel/TunnelEditReadOnlyKeyValueCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/EditTunnel/TunnelEditReadOnlyKeyValueCell.swift
@@ -6,29 +6,36 @@ import UIKit
class TunnelEditReadOnlyKeyValueCell: CopyableLabelTableViewCell {
var key: String {
get { return keyLabel.text ?? "" }
- set(value) {keyLabel.text = value }
+ set(value) { keyLabel.text = value }
}
var value: String {
get { return valueLabel.text }
set(value) { valueLabel.text = value }
}
- let keyLabel: UILabel
- let valueLabel: ScrollableLabel
+ override var textToCopy: String? {
+ return valueLabel.text
+ }
- override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
- keyLabel = UILabel()
+ let keyLabel: UILabel = {
+ let keyLabel = UILabel()
keyLabel.font = UIFont.preferredFont(forTextStyle: .body)
keyLabel.adjustsFontForContentSizeCategory = true
- valueLabel = ScrollableLabel()
+ keyLabel.textColor = .gray
+ return keyLabel
+ }()
+
+ let valueLabel: ScrollableLabel = {
+ let valueLabel = ScrollableLabel()
valueLabel.label.font = UIFont.preferredFont(forTextStyle: .body)
valueLabel.label.adjustsFontForContentSizeCategory = true
-
+ valueLabel.textColor = .gray
+ return valueLabel
+ }()
+
+ override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
- keyLabel.textColor = UIColor.gray
- valueLabel.textColor = UIColor.gray
-
contentView.addSubview(keyLabel)
keyLabel.translatesAutoresizingMaskIntoConstraints = false
keyLabel.textAlignment = .right
@@ -44,7 +51,7 @@ class TunnelEditReadOnlyKeyValueCell: CopyableLabelTableViewCell {
keyLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
keyLabel.leftAnchor.constraint(equalTo: contentView.layoutMarginsGuide.leftAnchor),
widthRatioConstraint
- ])
+ ])
contentView.addSubview(valueLabel)
valueLabel.translatesAutoresizingMaskIntoConstraints = false
@@ -52,11 +59,7 @@ class TunnelEditReadOnlyKeyValueCell: CopyableLabelTableViewCell {
valueLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
valueLabel.leftAnchor.constraint(equalToSystemSpacingAfter: keyLabel.rightAnchor, multiplier: 1),
valueLabel.rightAnchor.constraint(equalTo: contentView.layoutMarginsGuide.rightAnchor)
- ])
- }
-
- override var textToCopy: String? {
- return self.valueLabel.text
+ ])
}
required init?(coder aDecoder: NSCoder) {