Skip to content

Instantly share code, notes, and snippets.

@Maxatma
Created February 12, 2018 22:29
Show Gist options
  • Save Maxatma/cac6408a5876f70cd23559a8e786f919 to your computer and use it in GitHub Desktop.
Save Maxatma/cac6408a5876f70cd23559a8e786f919 to your computer and use it in GitHub Desktop.
Cannot convert return expression of type 'Date' to return type 'Date'
class Date {
class func from(year: Int, month: Int , day: Int ) -> Date {
let gregorianCalendar = NSCalendar(calendarIdentifier: .gregorian)!
var dateComponents = DateComponents()
dateComponents.year = year
dateComponents.month = month
dateComponents.day = day
let date = gregorianCalendar.date(from: dateComponents)!
return date
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment