summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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
+ }
+
}