Comments (2)
Perhaps RawValue
wouldn't help in all cases, because the data
would be written with writeValue. It may crash at runtime if the actual type is not supported by writeValue
.
You can try making T : Parcelable
, if that's possible. However this may also not be working in some cases, e.g. when the actual class is in another ClassLoader
.
A rule of thumb is to avoid generic types. You can make UIState
not Parcelable
, and parcelize it manually in every case where you otherwise specify the actual T
. E.g. you can transform UIState<SomeClass>
to a custom SavedUiStateWithSomeClass : Parcelable
.
If you need this logic in the base code (where UIState
is defined), then you can try supplying additional functions to save and restore UIState<T>
. E.g. this could be:
saveState: (UIState<T>) -> ParcelableContainer
restoreState: (ParcelableContainer) -> UIState<T>
Check out how it is done in Decompose.
from essenty.
Thanks for the quick reply I got it.
from essenty.
Related Issues (20)
- K2 compiler support HOT 9
- Following dependencies exported in the debugFramework binary are not specified as API-dependencies of a corresponding source set: HOT 2
- [2.0] Add ability to drop any previously saved state when creating `StateKeeper`
- Add UIViewController lifetime hooks HOT 4
- Utility function for StateKeeper HOT 8
- Custom Parcelers HOT 5
- Add Parceler and WriteWith HOT 1
- Upgrade to 0.4.0 removes support for js target HOT 8
- Add initialState argument to LifecycleRegistry factory function
- Comply with the new predictive back gesture on Android 13
- Document the code with KDocs
- Support optional values in StateKeeper's supplier HOT 1
- InstanceKeeper should throw an error when used after destroy
- TypeParceler is missing in `Parcelable` artifact HOT 2
- Unresolved reference: Parcelize HOT 12
- Remove depreciated back-pressed module
- [StateKeeper] Add another ```register``` method with onError parameter HOT 13
- Issue with Parcelable HOT 6
- Exception on building project Could not find "Essenty:lifecycle", kotlin\daemon, js (wasm) target HOT 4
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 essenty.