Commit 4bdd8f05 by Orkhan Alikhanov

Added custom switch size

parent 81909af0
...@@ -36,11 +36,11 @@ public enum SwitchState: Int { ...@@ -36,11 +36,11 @@ public enum SwitchState: Int {
case off case off
} }
@objc(SwitchSize) public enum SwitchSize {
public enum SwitchSize: Int {
case small case small
case medium case medium
case large case large
case custom(width: CGFloat, height: CGFloat)
} }
@objc(SwitchDelegate) @objc(SwitchDelegate)
...@@ -248,9 +248,11 @@ open class Switch: UIControl, Themeable { ...@@ -248,9 +248,11 @@ open class Switch: UIControl, Themeable {
case .large: case .large:
trackThickness = 24 trackThickness = 24
buttonDiameter = 28 buttonDiameter = 28
case .custom:
break
} }
frame.size = intrinsicContentSize invalidateIntrinsicContentSize()
} }
} }
...@@ -262,6 +264,8 @@ open class Switch: UIControl, Themeable { ...@@ -262,6 +264,8 @@ open class Switch: UIControl, Themeable {
return CGSize(width: 38, height: 38) return CGSize(width: 38, height: 38)
case .large: case .large:
return CGSize(width: 42, height: 42) return CGSize(width: 42, height: 42)
case .custom(let width, let height):
return CGSize(width: width, height: height)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment