I am trying to calculate the difference between 2 dates (one is the current date and the other from datepicker) in weeks and days then displaying the result on a label, that
You can find date different in weeks with this one line code.
let totalWeeks = Calendar.current.dateComponents([.weekOfMonth], from: Date(), to: endDate).weekOfMonth!
//for totalDays
let totalDays = Calendar.current.dateComponents([.day], from: Date(), to: endDate).day!