first time here. I'm a beginner student at swift (and programming in general) and I'm trying to make a simple app which will show 5 time values based on current day. I've tried a lot of stuff, but just cannot develop logic here. I will copy paste code (which some of it is pseudocode).
import UIKit
class ViewController: UIViewController {
// TIME Values
let time1 = ["07:01", "07:03", "07:03"] // ..... Array continues for 365 days, every string value representing each day
let time2 = ["11:59", "11:59", "12:00"] // ..... Array continues for 365 days, every string value representing each day
let time3 = ["14:15", "14:16", "14:17"] // ..... Array continues for 365 days, every string value representing each day
let time4 = ["17:12", "17:13", "17:15"] // ..... Array continues for 365 days, every string value representing each day
let time5 = ["19:10", "19:11", "19:12"] // ..... Array continues for 365 days, every string value representing each day
// Current Date
let todaysDate = NSDate()
// Pseudocode to extract the value from time arrays...
choose a value from TIME Values based on todaysDate
print(time1) // single value from time1 array (converted from string to date/time value) based on todaysDate
print(time2) // single value from time1 array (converted from string to date/time value) based on todaysDate
print(time3) // single value from time1 array (converted from string to date/time value) based on todaysDate
print(time4) // single value from time1 array (converted from string to date/time value) based on todaysDate
print(time5) // single value from time1 array (converted from string to date/time value) based on todaysDate
// Final values should be NSDate (or similar) values, because of time manipulation
let timeCorrection1 = ["00:02", "00:03", "00:03"] // ..... Correction continues for 365 days, every string value representing each day
let timeCorrection2 = ["00:02", "00:03", "00:03"] // ..... Correction continues for 365 days, every string value representing each day
let timeCorrection3 = ["00:02", "00:03", "00:03"] // ..... Correction continues for 365 days, every string value representing each day
let timeCorrection4 = ["00:02", "00:03", "00:03"] // ..... Correction continues for 365 days, every string value representing each day
let timeCorrection5 = ["00:02", "00:03", "00:03"] // ..... Correction continues for 365 days, every string value representing each day
override func viewDidLoad() {
super.viewDidLoad()
}
}
So the idea is to get a value from a string array based on currentdate, and have that in nsdate format (in MM:hh style) so it can be manipulated later, since I would like to subtract or add values from other variables (ie 00:02).
I hope I was clear enough, thank you very much in advance!