Host
NSHostingView を基盤とし、QuickGUI 内に 1 つの SwiftUI コンポーネントツリーをマウントするリーフです。
#インポート
quickgui から MacSwiftUiHost をインポートします。
use quickgui::*;#使い方
let mut host = MacSwiftUiHost::new(|_id| {})?;
host.sync(&[SwiftUiButton::new(1).label("Continue").into()])?;
native_view(host.view())#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
MacSwiftUiHost
ソースを見るpub 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>ソースを見るnew_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>ソースを見るviewpub 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>ソースを見るsync_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>ソースを見るfitting_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>ソースを見るeffect_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>ソースを見るnative_view
ソースを見るpub 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.
