-
-
Save gtomek/7d1f5e5c58d390c8bff2b9019c96b516 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified T: Any> Fragment.extra(key: String, default: T? = null) = lazy { | |
val value = arguments?.get(key) | |
if (value is T) value else default | |
} | |
inline fun <reified T: Any> Fragment.extraNotNull(key: String, default: T? = null) = lazy { | |
val value = arguments?.get(key) | |
requireNotNull(if (value is T) value else default) { key } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment