Hi all, have a question about Multiplatform Resour...
# compose
k
Hi all, have a question about Multiplatform Resources and strings. I want to use compose for android but SwiftUI on iOS, but I want to share strings if possible. What's the best way to do this since a string resource can only be gotten from a composable or suspend function. On Android I can call it using a @Composable but I'm not sure the best way to do it from iOS. I'm hoping to pass in the
StringResource
into the SwiftUI
View
.
v
I came up with this. There is some custom code for accessing Compose Resources in the same way as Moko Resources and I left it there because it could be useful (and I'm lazy to modify it to not use it 😄) But the main idea is in
StringDescLocalization.swift
, where I created a wrapper view, that takes care of localizing the
StringResource
. It should essentially mirror what happens in Compose.
When outside of SwiftUI, something in the lines of this can be used. But I find it very ugly 😅