-
Notifications
You must be signed in to change notification settings - Fork 89
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
Use Fruitties ViewModel on iOS #34
Conversation
cartland
commented
Sep 10, 2024
•
edited
Loading
edited
- Create IOSViewModelOwner in native source set
- Instantiate IOSViewModelOwner in iOSApp.swift
- Add helper function MainViewModel.newCreationExtras()
- Instantiate MainViewModel in IOSViewModelOwner
- collect() KMP StateFlow to State with SKIE preview API
- https://skie.touchlab.co/features/flows-in-swiftui
- Delete UIModel and use ViewModel directly
- Cart calculates total items, not number of distinct items
- Simplify Fruitties UI to match Android & iOS
Fruitties/androidApp/src/main/java/com/example/fruitties/android/ui/ListScreen.kt
Outdated
Show resolved
Hide resolved
Fruitties/shared/src/nativeMain/kotlin/com/example/fruitties/di/viewmodel/IOSViewModelOwner.kt
Outdated
Show resolved
Hide resolved
* addToCart does not need async keyword * await (home, cart) created an Xcode warning: Expression of type '((), ())' is unused * The async functions never return, so fixed by assigning result to _
* Minimum iOS deployment: 17.0 * Migrating from the Observable Object protocol to the Observable macro * https://developer.apple.com/documentation/swiftui/migrating-from-the-observable-object-protocol-to-the-observable-macro
* "Cart has $total items" * CartUiState -> CartUIState
* https://skie.touchlab.co/features/flows-in-swiftui * Delete UIModel * Delete StateHelper.swift
272e3df
to
06e67d1
Compare
06e67d1
to
f23f39a
Compare
74d2d24
to
a1ea1f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me, thanks for updating the sample and helping out with the KMP efforts :)
Fruitties/androidApp/src/main/java/com/example/fruitties/android/MyApplicationTheme.kt
Outdated
Show resolved
Hide resolved
* Edge-to-edge: Use contentWindowInsets to allow drawing to Bottom edge * TopBar: Use CenterAlignedTopAppBar to simplify centering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me from the edge-to-edge perspective!
Smail thing but be good to update following in REAMDE to include "Fruitties is a sample app using the Kotlin Multiplatform Room, DataStore and Ktor libraries to fetch, store and display data." |