[FR] Expand return type on imperative APIs
See original GitHub issueCurrently all of the imperative APIs return a Drawable
, which is great for drawing but it would be handy to know more information about the load itself. Things like: where did the image come from? (cache? network?)
I imagine something like the transition API:
enum class Source { DISK, MEMORY_CACHE, NETWORK }
sealed class LoadResult {
class Success(
val drawable: Drawable,
val source: Source
) : LoadResult()
class Error(
val drawable: Drawable?
) : LoadResult()
}
fun Coil.getResult(data: Any): LoadResult
This would be super useful for when Coil is being used in outside of View environments 🚀
WDYT?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
What are Symbolic and Imperative APIs in TensorFlow 2.0?
TensorFlow 2.0 provides another symbolic model-building APIs: Keras Functional. Sequential is for stacks, and as you've probably guessed, ...
Read more >Imperative Programming - Real World OCaml
Note that f must return unit , since it is expected to work by side effect rather than by returning a value, and...
Read more >React Hooks Explained: useImperativeHandle
This form should consist of two fields: one for the user's name, and one for ... useImperativeHandle will return this object when the...
Read more >RESTful web API design - Best Practices - Microsoft Learn
Learn the best practices for designing web APIs that support platform independence and service evolution.
Read more >Effective Fart: Design - Fart programming language
PREFER a non-imperative verb phrase for a boolean property or variable. ... DO type annotate public APIs. DON'T specify a return type for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@chrisbanes Ended up changing my mind on this 🙂. Implemented here: https://github.com/coil-kt/coil/pull/349 and will be part of the next release.
Oh neat I didn’t know about
OnChildPositioned
.Ah I see what you mean. My preference would be to integrate Coil’s Transition with the Compose Transition class if that’s possible. However, that doesn’t look likely at the moment… Going to play around with Compose more to improve my understanding.