Skip to content

Commit

Permalink
minor adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardobilia committed Jun 2, 2020
1 parent e49fcec commit c474181
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class StopwatchViewController: UIViewController {
counter += 0.001

let millisecond = counter * 1000
let remaingMilliseconds = Int((Int(millisecond) % 1000) / 10)
let second = Int((Int(millisecond) / 1000) % 60)
let minute = Int((Int(millisecond) / 1000) / 60 % 60)
let remaingMilliseconds = (Int(millisecond) % 1000) / 10
let second = (Int(millisecond) / 1000) % 60
let minute = (Int(millisecond) / 1000) / 60 % 60

DispatchQueue.main.async {
self.minuteLabel.text = String(format: "%02i", minute)
Expand Down Expand Up @@ -85,7 +85,7 @@ class StopwatchViewController: UIViewController {
}

@objc private func resetHandler() {
lappedTimes.removeAll()
lappedTimes = [LapTime]()
timerOn = false
counter = 0
timer.invalidate()
Expand Down
1 change: 0 additions & 1 deletion UIKit - Traditional/Stopwatch/Cells/LapTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class LapTableViewCell: UITableViewCell {
extension LapTableViewCell {

private func setupUI() {

contentView.addSubview(lapLabel)
contentView.addSubview(timerLabel)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class StopwatchViewController: UIViewController {
counter += 0.001

let millisecond = counter * 1000
let remaingMilliseconds = Int((Int(millisecond) % 1000) / 10)
let second = Int((Int(millisecond) / 1000) % 60)
let minute = Int((Int(millisecond) / 1000) / 60 % 60)
let remaingMilliseconds = (Int(millisecond) % 1000) / 10
let second = (Int(millisecond) / 1000) % 60
let minute = (Int(millisecond) / 1000) / 60 % 60

DispatchQueue.main.async {
self.minuteLabel.text = String(format: "%02i", minute)
Expand Down Expand Up @@ -82,11 +82,11 @@ class StopwatchViewController: UIViewController {
}

@objc private func resetHandler() {
lappedTimes = []
lappedTimes = [LapTime]()
timerOn = false
counter = 0
timer.invalidate()

DispatchQueue.main.async {
self.minuteLabel.setup(title: "00")
self.secondLabel.setup(title: "00")
Expand Down

0 comments on commit c474181

Please sign in to comment.