I'm new to Swift and I want to create an abstract factory for db access. Here is my protocol
protocol IDAOFactory
{
associatedtype DAO: IDAO
func createAccountDAO<DAO: IAccountDAO>() -> DAO
}
struct RealmFactory: IDAOFactory
{
}
protocol IDAO
{
associatedtype T
func save(object: T)
}
protocol IAccountDAO : IDAO
{
}
struct AccountDAORealm: IAccountDAO
{
}
How to implement the IDAOFactory in struct RealmFactory and IAccountDAO in struct AccountDAORealm? Can anybody help?
Aucun commentaire:
Enregistrer un commentaire