diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-10-05 15:03:44 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-11-03 13:30:51 +0100 |
| commit | 510741ca487ee078bed471a6f6ea12a2a7d0bb3a (patch) | |
| tree | c420e64857afbb4ae2661c7b8e8b338b4f47734b /ios | |
| parent | a9a5da6bc9676e59f7a04466372b359e65de627f (diff) | |
| download | mullvadvpn-510741ca487ee078bed471a6f6ea12a2a7d0bb3a.tar.xz mullvadvpn-510741ca487ee078bed471a6f6ea12a2a7d0bb3a.zip | |
CustomSwitchContainer: add isEnabled
Diffstat (limited to 'ios')
| -rw-r--r-- | ios/MullvadVPN/CustomSwitchContainer.swift | 14 |
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 + } + } |
