Brightify / Cuckoo

Boilerplate-free mocking framework for Swift!
MIT License
1.67k stars 175 forks source link

Can't generate a mock for protocol where Self: Class #447

Open alxdenis opened 1 year ago

alxdenis commented 1 year ago

Hello,

I create a Cuckoo Mock for this protocol . I precise that ViewModel is a Class.

protocol TravelersViewModelProtocol where Self: ViewModel {
    var membersDetailsCellViewModel: ParticipantsCellViewModel { get }
    var organizerCellViewModel: OrganizerCellViewModel { get }
    var invitationCellViewModels: [InvitationCellViewModel]? { get }
    var footerText: NSAttributedString { get }
    var logger: LoggerProtocol { get }
    var tracker: TrackerProtocol { get }
    func fetchInvitations()
    func sendCoTravelersScreenEvent()
}

However, I face this issue

type 'MockTravelersViewModelProtocol' does not conform to protocol 'TravelersViewModelProtocol'
TravelersViewModelProtocol' requires that 'MockTravelersViewModelProtocol' inherit from 'ViewModel'

I completely understand the issue but I don't know how to solve it.

Do you have any idea ?

Thanks in advance