I have a requirement where I am reading a list of dates in which I need to extract the seconds from each date to perform some logic. This is being done on the Watch. The following example is taking up approximately 50mb of memory which is not acceptable.
for count in 1 ... 500000 {
let currentDate = NSDate()
let now = Calendar.current.component(.second, from: currentDate as Date)
print(now)
}
Is there a more memory friendly way of extracting the seconds from a Date?