You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is it possible to make the Post Type in the PostUseCase as associatedtype so I write the required method only once:
I started to write the Code, but It dont't work.
public protocol UseCaseProvider {
associatedtype U: UseCase
func makeUseCase() -> U
}
Here is the UserCaseProvider in CoreDataPlatform:
public final class PostUseCaseProvider: Domain.UseCaseProvider {
private let coreDataStack = CoreDataStack()
private let postRepository: Repository<Post>
public init() {
postRepository = Repository<Post>(context: coreDataStack.context)
}
public func makeUseCase() -> Domain.UseCase {
return PostsUseCase(repository: postRepository)
}
}
Here get the error Type 'UserCaseProvider' does not conform to protocol 'UseCaseProvider' and Protocol 'UseCase' can only be used as a generic constraint because it has Self or associated type requirements'
Any idea?
The text was updated successfully, but these errors were encountered:
Hello,
is it possible to make the Post Type in the PostUseCase as associatedtype so I write the required method only once:
I started to write the Code, but It dont't work.
Here is the General UseCase in Domain:
Here is the General UseCaseProvider in Domain:
Here is the UserCaseProvider in CoreDataPlatform:
Here get the error Type 'UserCaseProvider' does not conform to protocol 'UseCaseProvider' and Protocol 'UseCase' can only be used as a generic constraint because it has Self or associated type requirements'
Any idea?
The text was updated successfully, but these errors were encountered: