I want selectedDate setter of type Date and getter to be of type String.
var selectedDate: Any? {
get {
//will return String
return DateTimeUtils.sharedInstance.formatFancyDate(date: self.selectedDate as! Date)
}
set(newValue) {
//will Set Date
self.selectedDate = DateTimeUtils.sharedInstance.dateFromStr(dateStr:newValue as! String)
}
}
Though i know work around but still wanna do it with setter and Getter in swift.
Thanks in Advance!!
Aucun commentaire:
Enregistrer un commentaire