I'm using date component to get user's age but I'm getting error. Can you please tell me what I'm missing here?
var calendar = Calendar(identifier: .gregorian)
var components: DateComponents? = calendar.dateComponents([.year, .month, .day], from: datePicker.date, to: Date)
I'm getting this error message:
Type of expression is ambiguous without more context
Similar question is asked here:
how to resolve “Type of expression in ambiguous without more context”? in swift 3.0
but it did not work for me.