Created
July 24, 2021 09:29
-
-
Save vikage/5c494bb0ea47a24405831a05ef500215 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 Project { | |
var name: String | |
var createdDate: Date | |
init(name: String, createdDate: Date = Date()) { | |
self.name = name | |
self.createdDate = createdDate | |
} | |
} | |
protocol ProjectDao { | |
func addProject(_ project: Project) | |
} | |
class ProjectDaoImpl: ProjectDao { | |
func addProject(_ project: Project) { | |
// Placeholder: Add object to realm | |
} | |
} | |
class ProjectManager { | |
var dao: ProjectDao | |
init(dao: ProjectDao) { | |
self.dao = dao | |
} | |
func addProject(_ project: Project) { | |
dao.addProject(project) | |
// Do anything else here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment