-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
iOS version #1892
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hi thanks for the clarification! I was already seeking for an alternative option to be able to contribute to OSM on my iOS - I was quite happy with my legacy Android phone to gain points and correct small glitches. Anyway THANKS for the efforts in the Android edition, I really like the app! |
@wtimme and I analyzed in a little more detail what needs to be done. 1. What needs to be done completely from scratchAnything view- and Android-related needs to be done from scratch. In a little more detail with very rough (week-wise) estimations:
So in total about 5 months or more. Some things (~2 months) are not so important for the core functionality and can be added later or bit by bit. 2. Things that can be shared but must be adapted to workThese are things that are pure Kotlin but currently have Android and no Java dependencies. Most classes that are in the /data/ directory. All DAOs to access the database, almost all controllers (classes that manage DAOs), download and upload logic, metadata, data, diff data, filters parser (similar to Overpass Wizard syntax) and all the quest types.
So, about 6 months or less (~1-3 months less) if one just ports/copypastas the used java libraries into swift code or finds very similar ready-made libraries that do the same. |
As far as a minimum viable product is concerned:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I was thinking about plans a bit and I am wondering whether things from
are worth doing right now. How likely is that work done now (without iPhone etc) is going to be useful and get us closer to potential iPhone version? Is any of this things useful on its own, or is it just making things not worse on Android and being a small piece of work toward iPhone version? Is it worth doing them just in case and to make iPhone version a tiny bit closer? For example in
it seems that creating intermediate interface should not be something horrible complicated. But does it make sense to do it right now, given that it will be a bit more confusing for people used to Android development? |
Some things make sense, because they don't make the code more complicated. Some others would only make sense if one really started to work on an iOS port because it would make the code more complicated. I'd say, these things could make sense on their own:
would make it possible to (also) log the logs to some place within the app, so that the log could be attached to crash reports and/or accessed by the user when asked about it.
That would be cleaner anyway, in my opinion. Maybe it is two things:
|
MapLibre (ex Mapbox SDK) now supports Metal, so an iOS port would probably (need to) use MapLibre instead of tangram-es. This requres to
As tangram is not really developed further, it might be a good choice to change to using the maplibre SDK for Android too. Or - bluesky - use/create a map view that directly renders the OSM data. |
Might want to monitor https://github.com/icerockdev/moko-mvvm - would, when using MVVM (the app currently doesn't though), make it possible to put even the |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
https://blog.jetbrains.com/kotlin/2022/10/kmm-beta/ And a well known german news site announcing this beta with some explanation: |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
I run a team of mobile developers who are into both iOS and Android. Would love to give this one a try. |
That's great to hear! Let me summarize for you the current state of affairs: Kotlin Multiplatform Mobile (KMM)A possible iOS port should be developed using Kotlin Multiplatform Mobile so that as much code can be shared as possible. (Yes, the amount of sharable code is considerate. Already 2-3 attempts at creating an iOS port from scratch were abandoned because they all underestimated the sheer size of the project.) The next self-contained steps (I can think of) in that regard are, for which PRs are welcome: 1. Get rid of Java and Android dependencies in application logic (=non-UI) code
2. big (once most application logic is free from Java/Android deps) create a Kotlin Multiplatform Mobile project setup and move the pure kotlin code to the shared module.
(If I see there is some commitment, I can also write these into tasks with more precise descriptions, rough time estimations, the github kanban-like board etc. later) Compose MultiplatformThe Android UI code is currently done with layout XMLs. In KMM, by default, one would write the iOS specific part (mostly: the UI) in Swift like in other iOS projects and access the application logic as a library. This means that the entire UI for iOS has to be re-written from scratch and also - importantly - having to be maintained separately from the Android UI.
The main downside of Compose Multiplatform is that we'd have to replace working code and that it is still in alpha. Working with cutting edge technology usually isn't pretty because the environment is changing under your feet and certain things don't work or only with messy workarounds. Additionally, Compose Multiplatform is not the silver bullet for the UI, as many Android/Java-only dependencies are used in the UI which would need to be replaced with an appropriate replacement on iOS. (E.g. the map renderer, the QR code generator, the physics simulation in the profile screen, ...). However, Jetpack Compose on the other hand is stable and has an almost 1:1 API as its Multiplatform brother, so "just" migrating step-by-step to Compose doesn't seem too risky. Also, as the list in the previous heading shows, there are enough other things to do (before) anyway, so when that is done, Compose Multiplatform and the environment around it matured more. In any case, I am currently familiarizing myself with the technology, so I might be able to say more about that in the future. In conclusion, there are many small tasks that can be done to further advance towards an eventual iOS port. These do not require a heavy or long-term commitment and can be included in the project as contributions just when they are done each. I know it can be somewhat demotivating to want to contribute to a project a huge project and then see that it will never be merged (because it becomes bigger and bigger along the process, a neverending construction site). For the above tasks, this is not a concern, as they are all each modular, self-contained and once merged live in the same repo and branch as the original Android version. Working with and getting to know new (Kotlin Multiplatform Mobile is in beta) or even cutting edge technology (Compose Multiplatform is in alpha) can be a motivation on its own. Especially, I find the prospect of (learning how to use) the two technologies combined together somewhat appealing also from a business perspective, as it may potentially cut the cost of developing an Android + iOS app to almost half. |
|
Kotlin Multiplatform (KMP) is making progress: sum up from a german IT new site: |
A roadmap for 2024 was introduced yesterday: https://blog.jetbrains.com/kotlin/2023/11/kotlin-multiplatform-development-roadmap-for-2024/ |
I recently reviewed what has been done by contributors to advance towards an eventual iOS version since 2021-something and came up with this extensive list of big and small contributions. It's quite a lot (, and sorry if I missed something, relation to iOS / multiplatform was often not specifically mentioned): by @neonowy
by @YoshiRulz by @riQQ
by @FloEdelmann
by @Helium314 , earlier @adrianclay by @adrianclay Thank you, guys, for all these contributions! So, I think it is time to shift gears now: Let's stop talking about preparing stuff for a potential iOS port that may or may not be developed, but ... actually do it! Let's try to achieve a working version of StreetComplete for iOS. It could be a minimum viable product at first, and then we will move from there. Of course, now as before, a lot of things need to be done, but I also hope that with me also having committed to it, more interested parties will help with this effort. (For now I will, for starters, read into Jetpack Compose (Multiplatform) and its best practices before I start working on the elephant in the room, which is the rework of the UI to Compose.) As mentioned earlier, the work involves somewhat modular tasks, so it remains an easy incremental process. I went created tickets in which I described in detail what has to be done and added them to a kanban-style project board. Let's continue there: Master Ticket: #5421Project Board: StreetComplete/Projects/1 |
There are two more PRs of mine that worked towards using kotlin test instead of JUnit: |
Edit: Planning for an iOS version continues in #5421
See also the last comment on this ticket
Quite a few times, it has been requested that an iOS version of this app is made available. This ticket shall serve as an explanation why this isn't possible but also as an entry point for why it is perhaps possible after all, but with enormous effort. So if you are an iOS developer and interested in creating an iOS version, also read this.
It's not possible
StreetComplete is developed as a native Android app and iOS is a completely different platform. There is no compatibility at all. Usually, if you see an app that is both available for Android and iOS, it is either not native (for example, just a website being displayed within an app or using a cross-platform framework such as ReactNative) or you are looking at two completely different applications, likely developed by two teams. This is my experience as a professional app developer.
Maybe it's possible
So, this is interesting if you are an iOS developer yourself. It is not planned from my side to do this.
Kotlin Multiplatform Mobile
This app is written in Kotlin, a modern programming language that is quite similar to Swift. Originally, Kotlin was built to run on the JVM, but by now, it can be transpiled into JavaScript, and with Kotlin Native, also to machine code, just like Swift.
This makes it possible to write iOS apps with Kotlin. Thus, Kotlin code of this project that is not dependent on any Java library (Http library etc) and also not dependent on the Android platform (UI, sensors, persistance management etc) could be used 1:1 in an iOS port of this app.
Such "pure" Kotlin code would be put into a common module that is shared between the iOS and the Android app.
However, not a big percentage of the total code in this project is such pure Kotlin code that has no dependencies to any other Java or Android dependencies. Most of the iOS app would still need to be written from scratch, in Swift or better in Kotlin, if possible. On the other hand, some of the code that is currently dependent on some Java library or Android dependency could be changed to not be dependent on it directly anymore but on a wrapper interface. Then, only that wrapper would need to also be implemented for iOS.
Multi-OS Engine
The MOE is a little different approach. So, the JVM of Android is called ART and is open source. On Android, we write apps that run within this virtual machine provided by the Android system. For iOS, there is no such virtual machine, apps run natively. But, what we could do, is to write an app that comes bundled with the ART virtual machine and does nothing else than to load the provided JVM bytecode. This is the approach of MOE..In other words, ART is automatically bundled in the app so that one can write an iOS app in the Java environment, making use of the Java ecosystem and libraries. iOS platform dependencies are accessed over an interface provided by MOE.
The difference to the Kotlin Native approach is, that Kotlin code that depends on Java libraries can also be moved to the common module that is shared between the iOS and the Android app. The only things that cannot be shared is code that is dependent on the Android platform, such as UI or currently persistance with SQLite (because it uses Android dependencies)
(see #1892 (comment))
The text was updated successfully, but these errors were encountered: