dbaroncelli / D-KMP-sample

D-KMP Architecture official sample: it uses a shared KMP ViewModel and Navigation for Compose and SwiftUI apps.
Apache License 2.0
824 stars 89 forks source link

iOS Native App #6

Closed adesugbaa closed 3 years ago

adesugbaa commented 3 years ago

Thanks for this project - I love the idea of the business logic and view models in the Kotloin shared layer.

I am concerned about the iOS application - it does not feel like a native application due to the navigation style being employed. There are no animations. Is this by design? Can we use this architecture with the regular iOS Navigation, so it feels completely native?

dbaroncelli commented 3 years ago

It could be easily solved by setting up the same iOS animation of the iOS Navigation. I am just not expert with iOS animations. Someone with experience in iOS animations can fix this. I have also tried wrapping the SwiftUI navigation, but I couldn't find a proper way, as SwiftUI NavigationLink is a dreadful piece of software. Let's hope that at the new WWDC, in a couple of weeks time, there will be upgrades to NavigationLink and SwiftUI navigation in general, so that it can be easier to wrap the native iOS navigation. Generally speaking, SwiftUI navigation is very limited and can get very messy when projects get complex. A shared navigation can make things very easy on bigger multiplatform projects. D-KMP is also providing multiple/vertical backstacks (i.e. remembering the deepest backstack entry in the previously selected level1/bottombar item), which natively on SwiftUI doesn't exist.

dbaroncelli commented 3 years ago

I actually found a solution, to use native SwiftUI navigation! It achieved that by keeping a map of all active NavigationLinks. I should be able to publish the update within a week.

adesugbaa commented 3 years ago

This is great to hear. Will look forward to the update - hopefully I can help with the iOS refinements...

adesugbaa commented 3 years ago

Hi. How are you? Any progress on the code?

dbaroncelli commented 3 years ago

Hi @adesugbaa, it took more time than expected. I am still refining. Hopefully I will be able to publish the update this week.

dbaroncelli commented 3 years ago

I am currently blocked by an issue on Compose beta08: https://issuetracker.google.com/issues/190795684

I will have to solve this, before publishing the new version

dbaroncelli commented 3 years ago

I read the issue will be fixed in Compose beta09, which will be released next week. So I should release the new version then.

dbaroncelli commented 3 years ago

I am trying to put all together now with the Desktop and Web version too, but it's still not ready. For the time being, writing shared code that is optimised for 4 different platforms (Android, iOS, Desktop, Web) presents several challenges. I still trying to understand a few things. I am planning to publish the next update when I am happy with overall result, but as it looks now, it might take some time.

dbaroncelli commented 3 years ago

Hi @adesugbaa, I have finally managed to publish the update. Now the iOS app is using NavigationLink under the hood, so native animation occurs when navigating to a new screen. Give me some feedback when you get the chance to try. I have also published the Desktop app.

adesugbaa commented 3 years ago

Thanks @dbaroncelli. I will test and provide feedback.