diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2022-07-27 16:58:05 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2022-07-28 11:21:51 +0200 |
| commit | ed00aec6a78497c2698acc63943ac69c5c41271b (patch) | |
| tree | 172cd528187c6527cfe721fe2c5c0d145a5a4e25 | |
| parent | a8b89ee5e9fe985120fa21b6fd0f0e4f6f344fd8 (diff) | |
| download | mullvadvpn-ed00aec6a78497c2698acc63943ac69c5c41271b.tar.xz mullvadvpn-ed00aec6a78497c2698acc63943ac69c5c41271b.zip | |
CustomTextView: refactor constant
| -rw-r--r-- | ios/MullvadVPN/CustomTextView.swift | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ios/MullvadVPN/CustomTextView.swift b/ios/MullvadVPN/CustomTextView.swift index 20eed2f786..8467511cb1 100644 --- a/ios/MullvadVPN/CustomTextView.swift +++ b/ios/MullvadVPN/CustomTextView.swift @@ -6,16 +6,14 @@ // Copyright © 2020 Mullvad VPN AB. All rights reserved. // -import Foundation import UIKit -private let kTextViewCornerRadius = CGFloat(4) - class CustomTextView: UITextView { + private static let textViewCornerRadius: CGFloat = 4 var roundCorners: Bool = true { didSet { - layer.cornerRadius = roundCorners ? kTextViewCornerRadius : 0 + layer.cornerRadius = roundCorners ? Self.textViewCornerRadius : 0 } } @@ -76,7 +74,7 @@ class CustomTextView: UITextView { } get { if roundCorners { - return UIBezierPath(roundedRect: accessibilityFrame, cornerRadius: kTextViewCornerRadius) + return UIBezierPath(roundedRect: accessibilityFrame, cornerRadius: Self.textViewCornerRadius) } else { return UIBezierPath(rect: accessibilityFrame) } @@ -105,7 +103,7 @@ class CustomTextView: UITextView { // Set visual appearance textColor = UIColor.TextField.textColor - layer.cornerRadius = kTextViewCornerRadius + layer.cornerRadius = Self.textViewCornerRadius clipsToBounds = true // Set content padding |
