跳到正文

Button

原生 SwiftUI 按钮,支持文本、SF Symbol、语义角色和按下处理。

#导入

从 quickgui 导入 SwiftUiButton。

use quickgui::*;

#用法

SwiftUiButton::new(1)
    .label("Save")
    .system_image("checkmark")
    .style(SwiftUiButtonStyle::BorderedProminent)

#API 参考

展开条目查看说明和完整签名。短横线表示声明中未记录默认值。

SwiftUiButton

查看源码
pub fn new(id: u64) -> Self
labelpub fn label(mut self, label: impl Into<Arc<str>>) -> Self—

Configures label for this part.

pub fn label(mut self, label: impl Into<Arc<str>>) -> Self
查看源码
system_imagepub fn system_image(mut self, name: impl Into<Arc<str>>) -> Self—

Configures system image for this part.

pub fn system_image(mut self, name: impl Into<Arc<str>>) -> Self
查看源码
rolepub fn role(mut self, role: SwiftUiButtonRole) -> Self—

Configures role for this part.

pub fn role(mut self, role: SwiftUiButtonRole) -> Self
查看源码
targetpub fn target(mut self, target: impl Into<Arc<str>>) -> Self—

Configures target for this part.

pub fn target(mut self, target: impl Into<Arc<str>>) -> Self
查看源码
test_idpub fn test_id(mut self, test_id: impl Into<Arc<str>>) -> Self—

Configures test id for this part.

pub fn test_id(mut self, test_id: impl Into<Arc<str>>) -> Self
查看源码
modifierpub fn modifier(mut self, modifier: SwiftUiModifier) -> Self—

Configures modifier for this part.

pub fn modifier(mut self, modifier: SwiftUiModifier) -> Self
查看源码
modifierspub fn modifiers(mut self, modifiers: impl IntoIterator<Item = SwiftUiModifier>) -> Self—

Configures modifiers for this part.

pub fn modifiers(mut self, modifiers: impl IntoIterator<Item = SwiftUiModifier>) -> Self
查看源码
stylepub fn style(mut self, style: SwiftUiButtonStyle) -> Self—

Convenience builder equivalent to Expo's `buttonStyle` modifier.

pub fn style(mut self, style: SwiftUiButtonStyle) -> Self
查看源码
control_sizepub fn control_size(mut self, size: SwiftUiControlSize) -> Self—

Convenience builder equivalent to Expo's `controlSize` modifier.

pub fn control_size(mut self, size: SwiftUiControlSize) -> Self
查看源码
disabledpub fn disabled(mut self, disabled: bool) -> Self—

Convenience builder equivalent to Expo's `disabled` modifier.

pub fn disabled(mut self, disabled: bool) -> Self
查看源码
actionpub fn action(mut self, enabled: bool) -> Self—

Configures action for this part.

pub fn action(mut self, enabled: bool) -> Self
查看源码