summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2021-10-05 15:03:44 +0200
committerAndrej Mihajlov <and@mullvad.net>2021-11-03 13:30:51 +0100
commit510741ca487ee078bed471a6f6ea12a2a7d0bb3a (patch)
treec420e64857afbb4ae2661c7b8e8b338b4f47734b
parenta9a5da6bc9676e59f7a04466372b359e65de627f (diff)
downloadmullvadvpn-510741ca487ee078bed471a6f6ea12a2a7d0bb3a.tar.xz
mullvadvpn-510741ca487ee078bed471a6f6ea12a2a7d0bb3a.zip
CustomSwitchContainer: add isEnabled
-rw-r--r--ios/MullvadVPN/CustomSwitchContainer.swift14
1 files changed, 14 insertions, 0 deletions
diff --git a/ios/MullvadVPN/CustomSwitchContainer.swift b/ios/MullvadVPN/CustomSwitchContainer.swift
index ebdcc33b13..fb2164ee9c 100644
--- a/ios/MullvadVPN/CustomSwitchContainer.swift
+++ b/ios/MullvadVPN/CustomSwitchContainer.swift
@@ -23,6 +23,16 @@ class CustomSwitchContainer: UIView {
let control = CustomSwitch()
+ var isEnabled: Bool {
+ get {
+ return control.isEnabled
+ }
+ set {
+ control.isEnabled = newValue
+ updateBorderOpacity()
+ }
+ }
+
override var intrinsicContentSize: CGSize {
return controlSize()
}
@@ -63,4 +73,8 @@ class CustomSwitchContainer: UIView {
return size
}
+ private func updateBorderOpacity() {
+ borderShape.opacity = control.isEnabled ? 1 : 0.2
+ }
+
}