Closed tryingtobegoodatcoding closed 1 year ago
let dateComponents = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute], from: yourDate) let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: false)
You have to convert your nextPrayer Date into DateComponents
` func calculateTime()->Void{ let date = cal.dateComponents([.year, .month, .day], from: Date()) var params = CalculationMethod.moonsightingCommittee.params params.madhab = .hanafi params.adjustments.dhuhr = -1 params.adjustments.asr = 3 params.adjustments.maghrib = -1 params.adjustments.isha = 2 if let prayers = PrayerTimes(coordinates: coordinates, date: date, calculationParameters: params) { let formatter = DateFormatter() formatter.timeStyle = .short formatter.timeZone = TimeZone(identifier: "Europe/London")!
`
This is the date so far but I am unable to get past "cannot convert value of type 'Date' to expected argument type 'DateComponents'"
Please any help appreciate, have a project due soon :(