Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializer requires that EventEmitter conform to 'DispatcherType' #412

Closed
darnfish opened this issue Aug 28, 2023 · 6 comments
Closed

Initializer requires that EventEmitter conform to 'DispatcherType' #412

darnfish opened this issue Aug 28, 2023 · 6 comments

Comments

@darnfish
Copy link

Hey there,

I'm trying to use Verge and VergeORM in my application. Right now I have a very small model with a couple entries and I'm trying to list all the entries using SwiftUI:

VStack {
    StoreReader(Pickup.shared.store) { state in
        VStack {
            ForEach(state.database.entities.home.allEntities()) { home in
                Text("\(home.rawID)")
            }
        }
    }
}

But on the StoreReader line, I get the following error:
Initializer 'init(debug:_:content:)' requires that 'EventEmitter<_StoreEvent<State, Never>>' conform to 'DispatcherType'

This seems to only happen if I add the ForEach block. Let me know if there's another way I should be doing this :~)

@muukii
Copy link
Collaborator

muukii commented Aug 29, 2023

I guess that ForEach requires the entity needs to conform to Identifiable?

@darnfish
Copy link
Author

Even when supplying an id field, it still errors :~(

Screen-Shot-2023-08-30-15-12-14 39

@muukii
Copy link
Collaborator

muukii commented Aug 31, 2023

ah probably, allEntities() returns AnyCollection. seems it does not fit with ForEach.init

@darnfish
Copy link
Author

Do you know what I should do to work around this issue?

@muukii
Copy link
Collaborator

muukii commented Sep 1, 2023

currently, allEntities() is not efficient but you could cast into Array. that may work

@darnfish
Copy link
Author

darnfish commented Sep 1, 2023

I'll try it, but I've since moved onto a different library. Hoping I can revisit this one in a couple years :~)

@darnfish darnfish closed this as completed Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants