-
public interface DestinationWrapperInterface you can implement with an object and then pass its class to the com.ramcosta.composedestinations.annotation.Destination.wrappers.
It lets you extract common logic or UI from your screens out to a reusable piece of code.
Note that the wrapper can still access its own ViewModel or any other state holder you need in its Wrap method.
DestinationScope is Wraps receiver and it allows you to get a hold of anything you may need here including the destination the wrapper is wrapping at the any given time (DestinationScope.destination), etc.
USAGE EXAMPLE 1
You can have multiple screens behind a PIN the user needs to enter. Using this feature for this use case means:
No need to change all of the affected screens' logic
No need to navigate to a intermediate screen (which is specially annoying if the final screen has navigation arguments).
USAGE EXAMPLE 2
You can also use it to display the state of the internet connection for example. Just use a
Boxwith a top right corner icon that shows up above the screen content whenever the connectivity is lost.