Created
February 12, 2018 22:29
-
-
Save Maxatma/cac6408a5876f70cd23559a8e786f919 to your computer and use it in GitHub Desktop.
Cannot convert return expression of type 'Date' to return type 'Date'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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