Commit 1ea919be by Daniel Dahan

minor boolean cleanup

parent 7f344994
Subproject commit d3efdaff89c024fc977904c997574b2cd90047df Subproject commit 1d49a5012d04f705557879f4e29770141022f8a7
...@@ -36,6 +36,7 @@ public enum EditorPlaceholderAnimation { ...@@ -36,6 +36,7 @@ public enum EditorPlaceholderAnimation {
} }
open class Editor: View { open class Editor: View {
/// Reference to textView.
public let textView = TextView() public let textView = TextView()
/// A boolean indicating whether the textView is in edit mode. /// A boolean indicating whether the textView is in edit mode.
...@@ -327,7 +328,7 @@ private extension Editor { ...@@ -327,7 +328,7 @@ private extension Editor {
/// Notification handler for when text editing began. /// Notification handler for when text editing began.
@objc @objc
func handleTextViewTextDidBegin() { func handleTextViewTextDidBegin() {
updateEditorState(animated: true) updateEditorState(isAnimated: true)
} }
/// Notification handler for when text changed. /// Notification handler for when text changed.
...@@ -339,17 +340,17 @@ private extension Editor { ...@@ -339,17 +340,17 @@ private extension Editor {
/// Notification handler for when text editing ended. /// Notification handler for when text editing ended.
@objc @objc
func handleTextViewTextDidEnd() { func handleTextViewTextDidEnd() {
updateEditorState(animated: true) updateEditorState(isAnimated: true)
} }
/// Updates editor. /// Updates editor.
func updateEditorState(animated: Bool = false) { func updateEditorState(isAnimated: Bool = false) {
updatePlaceholderVisibility() updatePlaceholderVisibility()
updatePlaceholderLabelColor() updatePlaceholderLabelColor()
updateDividerHeight() updateDividerHeight()
updateDividerColor() updateDividerColor()
guard animated && isPlaceholderAnimated else { guard isAnimated && isPlaceholderAnimated else {
layoutPlaceholderLabel() layoutPlaceholderLabel()
return return
} }
......
...@@ -161,7 +161,7 @@ extension UIImage { ...@@ -161,7 +161,7 @@ extension UIImage {
*/ */
open func crop(toWidth tw: CGFloat, toHeight th: CGFloat) -> UIImage? { open func crop(toWidth tw: CGFloat, toHeight th: CGFloat) -> UIImage? {
let g: UIImage? let g: UIImage?
let b: Bool = width > height let b = width > height
let s: CGFloat = b ? th / height : tw / width let s: CGFloat = b ? th / height : tw / width
let t: CGSize = CGSize(width: tw, height: th) let t: CGSize = CGSize(width: tw, height: th)
......
...@@ -135,7 +135,7 @@ open class TextView: UITextView { ...@@ -135,7 +135,7 @@ open class TextView: UITextView {
public let placeholderLabel = UILabel() public let placeholderLabel = UILabel()
/// A property to enable/disable operations on the placeholderLabel /// A property to enable/disable operations on the placeholderLabel
internal var isPlaceholderLabelEnabled: Bool = true internal var isPlaceholderLabelEnabled = true
/// Placeholder normal text /// Placeholder normal text
@IBInspectable @IBInspectable
......
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