Host
The NSHostingView-backed leaf that mounts one SwiftUI component tree inside QuickGUI.
#Import
Import MacSwiftUiHost from quickgui.
use quickgui::*;#Usage
let mut host = MacSwiftUiHost::new(|_id| {})?;
host.sync(&[SwiftUiButton::new(1).label("Continue").into()])?;
native_view(host.view())#API reference
Expand an entry for its description and complete signature. A dash means no declaration default is documented.
MacSwiftUiHost
View sourcepub fn new(action: impl Fn(u64) + 'static) -> Result<Self, String>new_with_eventspub fn new_with_events( action: impl Fn(u64) + 'static, presentation: impl Fn(u64, bool) + 'static, ) -> Result<Self, String>—
Configures new with events for this part.
pub fn new_with_events( action: impl Fn(u64) + 'static, presentation: impl Fn(u64, bool) + 'static, ) -> Result<Self, String>View sourcenew_with_control_eventspub fn new_with_control_events( action: impl Fn(u64) + 'static, presentation: impl Fn(u64, bool) + 'static, value: impl Fn(u64, &str) + 'static, submit: impl Fn(u64) + 'static, ) -> Result<Self, String>—
Construct a host that also reports controlled value changes and text-field submissions.
pub fn new_with_control_events( action: impl Fn(u64) + 'static, presentation: impl Fn(u64, bool) + 'static, value: impl Fn(u64, &str) + 'static, submit: impl Fn(u64) + 'static, ) -> Result<Self, String>View sourceviewpub fn view(&self) -> &objc2_app_kit::NSView—
syncpub fn sync(&mut self, elements: &[SwiftUiElement]) -> Result<bool, String>—
Synchronize the complete ordered SwiftUI descriptor tree. Returns whether the native root view or one of its embedded QuickGUI surfaces changed.
pub fn sync(&mut self, elements: &[SwiftUiElement]) -> Result<bool, String>View sourcesync_buttonspub fn sync_buttons(&mut self, buttons: &[SwiftUiButton]) -> Result<bool, String>—
Compatibility convenience for the original button-only bridge.
pub fn sync_buttons(&mut self, buttons: &[SwiftUiButton]) -> Result<bool, String>View sourcefitting_sizepub fn fitting_size(&self) -> Result<Size, String>—
Current fitting size of the hosted SwiftUI controls at their native size. The headroom the host keeps around content whose effects draw past its bounds, such as Liquid Glass, is excluded; [`Self::effect_inset`] reports it, and placing the view with [`crate::native_view_with_outset`] keeps it outside layout.
pub fn fitting_size(&self) -> Result<Size, String>View sourceeffect_insetpub fn effect_inset(&self) -> Result<f32, String>—
Padding the host keeps on each side of its content for effects that draw past a control's bounds; zero unless the content contains such a control.
pub fn effect_inset(&self) -> Result<f32, String>View sourcenative_view
View sourcepub fn native_view(view: &NSView) -> ElementEmbed an AppKit view as a declarative leaf on macOS. QuickGUI synchronizes layout, clipping, visibility, and sibling order while AppKit keeps ownership of the view's rendering and input behavior.
