Skip to content

Commit

Permalink
Remove SwiftUI stateNullable helper for StringDesc
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
darronschall committed Apr 18, 2024
1 parent bbc5714 commit 4a3cabf
Showing 1 changed file with 0 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,6 @@ extension ObservableObject where Self: ViewModel {
mapper: { $0 as? Array<T> }
)
}

func stateNullable(_ flowKey: KeyPath<Self, CStateFlow<StringDesc>>) -> String? {
return stateNullable(
flowKey,
equals: { $0 === $1 },
mapper: { $0?.localized() }
)
}

func stateNullable<T: KotlinBase>(_ flowKey: KeyPath<Self, CStateFlow<T>>) -> T? {
return stateNullable(
Expand Down

0 comments on commit 4a3cabf

Please # to comment.