aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/View/BorderedTextButton.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/View/BorderedTextButton.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/View/BorderedTextButton.swift20
1 files changed, 10 insertions, 10 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/View/BorderedTextButton.swift b/WireGuard/WireGuard/UI/iOS/View/BorderedTextButton.swift
index ab6dcc5..b1951e4 100644
--- a/WireGuard/WireGuard/UI/iOS/View/BorderedTextButton.swift
+++ b/WireGuard/WireGuard/UI/iOS/View/BorderedTextButton.swift
@@ -10,42 +10,42 @@ class BorderedTextButton: UIView {
button.titleLabel?.adjustsFontForContentSizeCategory = true
return button
}()
-
+
override var intrinsicContentSize: CGSize {
let buttonSize = button.intrinsicContentSize
return CGSize(width: buttonSize.width + 32, height: buttonSize.height + 16)
}
-
+
var title: String {
get { return button.title(for: .normal) ?? "" }
set(value) { button.setTitle(value, for: .normal) }
}
-
+
var onTapped: (() -> Void)?
-
+
init() {
super.init(frame: CGRect.zero)
-
+
layer.borderWidth = 1
layer.cornerRadius = 5
layer.borderColor = button.tintColor.cgColor
-
+
addSubview(button)
button.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
button.centerXAnchor.constraint(equalTo: centerXAnchor),
button.centerYAnchor.constraint(equalTo: centerYAnchor)
])
-
+
button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside)
}
-
+
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
-
+
@objc func buttonTapped() {
onTapped?()
}
-
+
}