Fragment Args¶
Fragment arguments without ceremony thanks to delegated properties.
Supported platforms: Android.
Example¶
class YourFragment : Fragment() {
var someRequiredId: Int by arg()
var optionalArg: String? by argOrNull()
var nonNullOptionalArg: String by argOrDefault("")
var anotherNonNullOptionalArg: String by argOrElse { "splitties rock!".capitalize() }
private fun yourMethod() = yourCode()
}
fun createYourFragment(someId: Int): Fragment = YourFragment().apply {
someRequiredId = someId
}
Download¶
implementation("com.louiscad.splitties:splitties-fragmentargs:3.0.0-beta01")