Skip to main content

apply_modifier

Function apply_modifier 

Source
pub unsafe fn apply_modifier(
    view: &ViewHandle,
    modifier_meta: *const c_void,
    bytes: &[u8],
) -> ViewHandle
Expand description

Apply a ViewModifier value to a view.

The general case, and the way out of a corner: SwiftUI’s convenience spellings are increasingly @_alwaysEmitIntoClient, which means the compiler inlines them into the caller and the framework exports no symbol to call. View.modifier(_:) is exported, is generic over the modifier with no constraint at all, and returns ModifiedContent<Self, M> concretely — so building M’s value and handing it over reaches every one of them.

§Safety

bytes must be a valid value of the type modifier_meta describes, and that type must conform to ViewModifier.