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

Fix compiler error in Swift UI helpers when not using moko-resources #269

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

darronschall
Copy link
Contributor

The StringDesc protocol comes from projects that also incorporate moko-resources. For projects that use only moko-mvvm, this code was generating a compiler error:

ViewModelStateNullable.swift:99:60: Cannot find type 'StringDesc' in scope

Note that this particular helper didn't have a corresponding state version in ViewModelState. After this change, both state and stateNullable are consistent in terms of the methods they offer.

The `StringDesc` protocol comes from projects that also incorporate moko-resources. For projects that use only moko-mvvm, this code was generating a compiler error:

```
ViewModelStateNullable.swift:99:60: Cannot find type 'StringDesc' in scope
```

Note that this particular helper didn't have a corresponding `state` version in `ViewModelState`. After this change, both `state` and `stateNullable` are consistent in terms of the methods they offer.
Comment on lines -99 to -105
func stateNullable(_ flowKey: KeyPath<Self, CStateFlow<StringDesc>>) -> String? {
return stateNullable(
flowKey,
equals: { $0 === $1 },
mapper: { $0?.localized() }
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's should not be deleted. it's should be moved to mvvm-flow-resources

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, I'll make that change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, there isn't a separate mvvm-flow-resources SwiftUI project (something like mokoMvvmFlowResourcesSwiftUI) to move this particular piece of code to.

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

Successfully merging this pull request may close these issues.

2 participants