Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
no longer unnecessarily wrapping conditionals or arguments in parentheses
  • Loading branch information
krugerk committed Oct 21, 2024
1 parent 1c5db3a commit cbe6b00
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions BeeSwift/GoalViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class GoalViewController: UIViewController, UIScrollViewDelegate, DatapointTabl
}

self.navigationItem.rightBarButtonItems = [UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(self.actionButtonPressed))]
if (!self.goal.hideDataEntry) {
if !self.goal.hideDataEntry {
self.navigationItem.rightBarButtonItems?.append(UIBarButtonItem(image: UIImage.init(named: "Timer"), style: .plain, target: self, action: #selector(self.timerButtonPressed)))
}

Expand Down Expand Up @@ -457,12 +457,12 @@ class GoalViewController: UIViewController, UIScrollViewDelegate, DatapointTabl
}

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if (textField.isEqual(self.valueTextField)) {
if textField.isEqual(self.valueTextField) {
// Only allow a single decimal separator (, or .)
if textField.text!.components(separatedBy: ".").count > 1 {
if string == "." || string == "," { return false }
}
if (string == ",") {
if string == "," {
textField.text = textField.text! + "."
return false
}
Expand Down

0 comments on commit cbe6b00

Please sign in to comment.