Commit 8577de35 by Orkhan Alikhanov

Applied correct setter and getter convention

parent a045b498
...@@ -36,11 +36,11 @@ import UIKit ...@@ -36,11 +36,11 @@ import UIKit
public extension UIButton { public extension UIButton {
/// Convenience way to change titleLabel font size. /// Convenience way to change titleLabel font size.
var fontSize: CGFloat { var fontSize: CGFloat {
set {
titleLabel?.font = titleLabel?.font?.withSize(newValue) ?? UIFont.systemFont(ofSize: newValue)
}
get { get {
return titleLabel?.font?.pointSize ?? UIFont.buttonFontSize return titleLabel?.font?.pointSize ?? UIFont.buttonFontSize
} }
set(value) {
titleLabel?.font = titleLabel?.font?.withSize(value) ?? UIFont.systemFont(ofSize: value)
}
} }
} }
...@@ -36,11 +36,11 @@ import UIKit ...@@ -36,11 +36,11 @@ import UIKit
public extension UILabel { public extension UILabel {
/// Convenience way to change font size. /// Convenience way to change font size.
var fontSize: CGFloat { var fontSize: CGFloat {
set {
font = font?.withSize(newValue) ?? UIFont.systemFont(ofSize: newValue)
}
get { get {
return font?.pointSize ?? UIFont.labelFontSize return font?.pointSize ?? UIFont.labelFontSize
} }
set(value) {
font = font?.withSize(value) ?? UIFont.systemFont(ofSize: value)
}
} }
} }
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