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

Goodbye RxSwift 👋🥲 #30

Merged
merged 8 commits into from
May 31, 2022
Merged

Goodbye RxSwift 👋🥲 #30

merged 8 commits into from
May 31, 2022

Conversation

pchmelar
Copy link
Member

@pchmelar pchmelar commented May 23, 2022

📝 Description

  • This PR removes RxSwift dependency and refactors the rest of the app into SwiftUI + MVI + async/await 🚀

💡 What’s new?

  • All UseCases + Repositories are now using async/await instead of RxSwift
  • All views are now in SwiftUI and all view models are using MVI pattern
  • LocationProvider protocol and SystemLocationProvider implementation (we were using CLLocationManager directly in the LocationRepository, which wasn't right in terms of Clean Architecture)
  • More granular Error handling (take a look at AuthError and ValidationError)
  • AppTheme is now using SwiftUI.Color and SwiftUI.Font (instead of UIColor and UIFont)
  • BaseHostingController for defining common background color and back button title
  • Reusable UserView and PrimaryProgressView

😶 What’s missing?

  • Fix KMP
  • Because I wanted to finish this ASAP in order to work on more important problems (modularisation etc) I didn't replace all of the functionality we had in UIKit views. Mainly there are no examples of pull-to-refresh and paging, we should add them in next PRs.

📚 References

@pchmelar
Copy link
Member Author

I fixed all tests to reflect the changes. There were some minor issues along the way.

  • I had to provide a manual mock for DatabaseProvider. Although SwiftyMocky supports generics, it is needed to add additional comparators to Matcher instance, which seems overly complicated. In the end, we aren't using SwiftyMocky that much, so maybe we can take a step back and use just underlying Sourcery for a mock generation. 🤔
  • Our ViewModels have .onAppear that can load some data asynchronously via Task. However, as .onAppear doesn't return anything (compared to .onIntent) we can't await its completion in the tests. Fortunately, we have an array of all running tasks in BaseViewModel, so we can use a little workaround in tests:
for task in vm.tasks { await task.value }

@pchmelar pchmelar merged commit cfa31e8 into develop May 31, 2022
@pchmelar pchmelar deleted the feature/goodbye-rxswift branch May 31, 2022 11:24
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.

1 participant