var testTwo: Double = 0
testDouble = 80
testTwo = 200
var testThree: Int = 0
testThree = Int(testTwo/testDouble)
var testDate: Date = .now
var dateComponent = DateComponents()
dateComponent.day = testThree
var newDate: Date = Calendar.current.date(byAdding: dateComponentwith a thread error , to: testDate)!
This code works in a playground. However, when I try to use it in Xcode for my app it fails with the following error: Thread 1: Fatal error: Double value cannot be converted to Int because it is either infinite or NaN I printed the value being converted to Int and it was not NAN or infinite.