Created
December 11, 2016 21:00
-
-
Save Eluss/fc0212d0861c469b9a7e38046d10f633 to your computer and use it in GitHub Desktop.
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 DetailedPersonViewModel: PersonViewModel { | |
var title: String | |
var birthday: String | |
var dateFormatter = DateFormatter() | |
init(person: Person) { | |
title = person.firstName + " " + person.lastName | |
dateFormatter.dateStyle = .short | |
birthday = dateFormatter.string(from: person.birthday) | |
} | |
func doSomeWork() { | |
// Some complicated logic | |
} | |
} | |
class LuckyPersonViewModel: PersonViewModel { | |
var title: String | |
var birthday: String | |
var dateFormatter = DateFormatter() | |
init(person: Person) { | |
title = "Lucky " + person.firstName | |
dateFormatter.dateStyle = .long | |
birthday = "Birthday: " + dateFormatter.string(from: person.birthday) | |
} | |
func doSomeWork() { | |
// Any other logic | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment