Group Group Group Group Group Group Group Group Group

Follow Repository Pattern with async API Protocol

How can I follow the next pattern

protocol Repository {
    func getAll() -> [Model]
}

If I have a API Remote protocol that works async with a completion closure

protocol APIRemote {
    func request(_ endpoint:Endpoint, handler: @escaping(Result<Model, Error>) -> ())
}

I want to know how to do it without using a third-party framework. How can I handle a repository with API calls like that.

Thanks in advance

@rcach Can you please help with this when you get a chance? Thank you - much appreciated! :]