EXTENSION
UpdateChildScreenViewController
¶
extension UpdateChildScreenViewController where Self: UIViewController
Methods¶
update(child:with:in:onChange:)
¶
public func update<VC: UIViewController, ScreenType: Screen>(
child: ReferenceWritableKeyPath<Self, VC>,
with screen: ScreenType,
in environment: ViewEnvironment,
onChange: (VC) -> Void = { _ in }
)
Updates the view controller at the given child
key path with the
ViewControllerDescription
from screen
. If the type of the underlying view
controller changes between update passes, this method will remove
the old view controller, create a new one, update it, and insert it into the view controller hierarchy.
The view controller at child
must be a child of self
.
- Parameters:
- parameter child: The
KeyPath
which describes what view controller to update. This view controller must be a direct child ofself
. - parameter screen: The
Screen
instance to apply to the view controller. - parameter environment: The
environment
to used when updating the view controller. - parameter onChange: A callback called if the view controller instance changed.
Parameters¶
Name | Description |
---|---|
child | The KeyPath which describes what view controller to update. This view controller must be a direct child of self . |
screen | The Screen instance to apply to the view controller. |
environment | The environment to used when updating the view controller. |
onChange | A callback called if the view controller instance changed. |