Created
March 13, 2018 06:54
-
-
Save joshdance/865b2cdf970d69153559eca39b52727f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func calculatePushupsToday() { | |
//get todays date | |
let calendar = NSCalendar.current | |
var todaysPushupNumber = 0 | |
for workout in myArray { | |
//see if any of the entries = today | |
if calendar.isDateInToday(workout.dateOfSave) == true | |
{ | |
//add them up. | |
todaysPushupNumber = todaysPushupNumber + workout.numberOfPushups | |
} | |
} //end for workout loop | |
let todaysPushupLabelText : String = String(todaysPushupNumber) + " pushups today" | |
pushupsTodayLabel.text = String(todaysPushupLabelText) | |
} //end calculatePushupsToday |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment