EXTENSION
Screen
¶
extension Screen
Methods¶
adaptedEnvironment(key:value:)
¶
public func adaptedEnvironment<Key: ViewEnvironmentKey>(
key: Key.Type,
value: Key.Value
) -> AdaptedEnvironmentScreen<Self>
Wraps this screen in an AdaptedEnvironmentScreen
with the given environment key and value.
adaptedEnvironment(keyPath:value:)
¶
public func adaptedEnvironment<Value>(
keyPath: WritableKeyPath<ViewEnvironment, Value>,
value: Value
) -> AdaptedEnvironmentScreen<Self>
Wraps this screen in an AdaptedEnvironmentScreen
with the given keypath and value.
adaptedEnvironment(adapting:)
¶
public func adaptedEnvironment(
adapting: @escaping (inout ViewEnvironment) -> Void
) -> AdaptedEnvironmentScreen<Self>
Wraps this screen in an AdaptedEnvironmentScreen
with the given configuration block.
asAnyScreen()
¶
public func asAnyScreen() -> AnyScreen
Wraps the screen in an AnyScreen
canUpdate(viewController:with:)
¶
public func canUpdate(viewController: UIViewController, with environment: ViewEnvironment) -> Bool
If the given view controller is of the correct type to be updated by this screen.
If your view controller type can change between updates, call this method before invoking update(viewController:with:)
.
update(viewController:with:)
¶
public func update(viewController: UIViewController, with environment: ViewEnvironment)
Update the given view controller with the content from the screen.
Note¶
You must pass a view controller previously created by a compatible ViewControllerDescription
that passes canUpdate(viewController:with:)
. Failure to do so will result in a fatal precondition.
buildViewController(in:)
¶
public func buildViewController(in environment: ViewEnvironment) -> UIViewController
Construct and update a new view controller as described by this Screen. The view controller will be updated before it is returned, so it is fully configured and prepared for display.