Hey, is there a way to view the shared directory f...
# multiplatform
r
Hey, is there a way to view the shared directory from xcode? tried installing
xcode-kotlin
but it lead to xcode crash everytime i try to open it
d
I find it useful to add the Kotlin source folders to the Xcode project as folder references (Add Files to …, then uncheck Copy items if needed and select Create folder references). This adds the folders to Xcode’s project navigator and lets you open them via Cmd+Shift+O just as any other source file in the project.
v
I wonder how iOS developers actually develop on KMP. Can you use only XCode? Can you use only AS? Or you always need to use both?
d
In my experience: definitely both.
2
r
I wonder how iOS developers actually develop on KMP.
I think its mostly the Android team would be the one to push it (kinda force it) on iOS guys, so I don’t think any iOS person will be interested in creating a KMM project 😆
thank you @Daniel Seither let me try that out
am I doing it correctly? just select the shared folder?
👍 1
v
Yea, iOS devs are not interested in KMP. We are currently struggling with finding a developer for iOS side.
r
yeah, its like asking you to write in swift and kotlin to implement a feature in Android, I wouldn’t like it, but once it has good resources and its more popular I think it will be used more to save time as most of the code would be shared, so it will be rather a company request at that point
btw @Daniel Seither is there I way I can open the kotlin source class when I click on it from xcode swift? e.g. in xcode, if I click
cmd
and click on
Greeting()
it forwards me to the kotlin reference not the swift translation
d
is there I way I can open the kotlin source class when I click on it from xcode swift?
No, I don’t think so. The integration is not great.
r
yeah.. alright thank you then thank you color
hope it gets better support by time
ok as we’re here, I’m heavily using java.time.LocalDateTime in my project, and well, this is java, is there a kotlin replacement that is not much different in implementation?
is this a good replacement? https://github.com/Kotlin/kotlinx-datetime
v
I mean, it is in kotlin repository and already has 1900 stars
Does it really matter at this point if it is actually good?
r
haha, yeah my concern was that I need to find something that will have minimal changes, rather than just reliable
cuz my whole app relies on time objects
but I’ll try this one first and see
m
The main thing missing from the kotlinx-datetime library is formatting and parsing. But you can create some expect/actual to handle that if needed.
r
yeah 3 hours into it, I hate it, its actually missing a lot of things, or has wordarounds for easy things in the java one formatting, parsing, calculating TimeUnit between 2 dateTimes…
I’m figuring each one on its own
now also missing
plus
function on LocalDateTime and LocalTime, there is
plus
only in LocalDate for some reason
still haven’t figured that out
Copy code
datetime.plusMinutes(start)
now looks like this
Copy code
datetime.toInstant(TimeZone.currentSystemDefault()).plus(start, DateTimeUnit.MINUTE).toLocalDateTime(TimeZone.currentSystemDefault())
I hope I’m doing something wrong and things not as complicated as they seem to be now 😅
v
Formatting and parsing? Like if I want to get a string 50 sec ago / 5 min ago / 2 days ago/etc I will have issue? Which is often used for messages, even like here, in the slack
15 hours ago
r
yeah its not as intuitive and easy as java.time, also for formatting you have to use java DateTimeFormatter, so I ended up creating an
expect
class and 2 actual classes for formatting, on in Android and on iOS (didn’t implement the iOS one yet)
will probably write an article about it, cuz my app relies a lot on time so I used almost every functionality someone would think of 😅
also a downside: there is almost no resources
v
As for pretty much anything
r
yeah, KMM is lacking a lot of resources
I also struggled while migrating from Room to SQLDelight, so wrote an article about it for others. trying to add some resources to the internet to fill in the gab a bit here it is if someone is interested
v
Dunno, it wasn't issue for me to swap room for SQLDelight for a new app
r
yeah in a new app its easy, issues come when its an existing app that you’re trying to make a KMM app 😅
v
Copy code
Kotlin multiplatform (KMP), previously known as (KMM)
r
yup, kotlin deprecated the term “KMM” which used to stand for “Kotlin multiplatfrom mobile” https://x.com/kotlin/status/1686018987304292352?s=20