docs/fragment-arguments.md
Although Mavericks, doesn't have to be used with Fragments, it has some helpers in case it is.
When creating a Fragment:
Parcelable or Serializable objectyourArgs.asMavericksArgs()val fragment = YourFragment()
fragment.arguments = yourArgs.asMavericksArgs()
Create a property in your fragment:
private val args: YourArgsType by args()
That's it!
MavericksStateCreate a secondary constructor that has 1 parameter of the same type as your Fragment arguments. Mavericks will automatically get the arguments off your Fragment and call this constructor with them when creating your State.
data class MyState(
val itemId: String,
val item: Async<Item> = Uninitialized
) : MavericksState {
constructor(args: YourArgs) : this(args.itemId)
}