Comments (9)
Try to use:
https://github.com/Kotlin/kotlinx.collections.immutable
map is not Immutable type, i think on android you doesn't have problem because in latest versions of jetpack compose has optimisations with copy this library under hood(or you have problem on android, but don't see it). My opinion you should use persistentMapOf, not simple map.
from moko-resources.
@ExNDY, it's the same with persistentMapOf
according to the profiler in android, the memory usage does not exceed 160 MB
from moko-resources.
Ios != Android,
for android used jetpack compose, for ios jetbrains solution. U should think about recomposition and ios platform is sensitive for this.
Please try on ios and say your result
from moko-resources.
not sure what exactly you mean by recomposition
i tried copying the fontFamilyResource
code to my project: removed @Composable
and remember
, made the fonts a constant. after that, memory consumption does not exceed 200 MB
i don't think the problem is with the moko-resources library
val montserratFontFamilyMap: Map<Montserrat, FontFamily> by lazy {
mapOf(
Montserrat.Black to fontFamilyResource(MR.fonts.montserrat_black.montserrat_black),
Montserrat.Light to fontFamilyResource(MR.fonts.montserrat_light.montserrat_light),
Montserrat.Bold to fontFamilyResource(MR.fonts.montserrat_bold.montserrat_bold),
...
)
)
from moko-resources.
i don't cleary understand you, you find problem with your logic on ui? or what's happined? Recomposition for me is base of compose:) If you use unstable types inside composition on every recomposition of screen (recreating/update screen content you create new values for unstable variable) because one of solution for best performance don't usage of list for remember, for example.
Because i'm question for you, about usage in yours code unstable map.
If your problem is solved - is cool.
from moko-resources.
i haven't solved the problem, most likely it's because of remember
and how it's implemented for ios
if you think i'm using unstable types, then why isn't there this problem on android?
from moko-resources.
you read my first message? Android has optimisations under hood. How much experience you have in compose? I need understand what i can do for this issue
from moko-resources.
yes, i saw the message. but your assumption that android has optimization under the hood doesn't seem convincing. simply removing remember
eliminates the problem
fonts don't depend on the ui state. is it possible to make fontFamilyResource
not @Composable
?
from moko-resources.
Hm, man, you "rewrite" on non compose style. You don't hear important argument: jetpack compose is not compose Multiplatform on other platforms, that framework very sensitive for data types. Usage of lazy inside Composable talking about you don't know principles of Compose. Sorry, i'm question you about your experience in Compose for that. You ignore me with this question. Question about persistentMapOf on ios was ignored too. If somebody wants chat with you that's cool.
from moko-resources.
Related Issues (20)
- 0.24.0-beta-4 incorrectly handles plurals with `"` character; displays as `\"` on iOS and doesn't display on Android. HOT 2
- Crash when using MR.strings() in unit tests iOS HOT 9
- Are there plans to support linuxX64? HOT 1
- Remove unnecessary dependency HOT 1
- How do I get the text value on JVM? HOT 2
- Have a dumb question about a different approach to save resources directly in a Kotlin file :D HOT 1
- 0.24.0-beta-5 creates invalid unicode escape sequence HOT 8
- Can't use Moko resources for JVM target HOT 3
- Add dark mode variants for images HOT 2
- How use fonts in swift ui
- Svg icons with alpha color become black on iOS
- Unable to compile after trying to update to 0.24.0: Unable to find method GenerateMultiplatformResourcesTask.onlyIf HOT 5
- Formatted localization string from swift code
- Gradle Sync failing in Android Studio HOT 3
- Cannot access 'dev.icerock.moko.resources.ResourceContainer' HOT 9
- Moko resources and tvOS support HOT 1
- Calling localized() outside of Composable function HOT 2
- Not being generated Resources String Kotlin 2.0 HOT 2
- Handle different build flavors resources HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moko-resources.