当前位置:网站首页>Swiftui 4 new features complete toggle and mixed toggle multiple binding components
Swiftui 4 new features complete toggle and mixed toggle multiple binding components
2022-07-01 20:01:00 【Knowledge fatness】
from SwiftUI 4 Start ,Toggle Views can now be bound to multiple values . Now we can use the following overload initializer to create switches for the set of values :
init(isOn:label:)
- isOn: Is a binding collection , Used to determine whether the switch is on 、 Close or mix .
- Label: It is a view that describes the purpose of switching .
There are two additional overload initializations :
init(_:isOn:)
The first parameter is titleKey( The key used to describe the switching localization title for switching purposes ), The second parameter is isOn( Make sure the switch is on 、 Closed or mixed binding collection )
init(_:isOn:)
The initializer above is similar to the previous one , It just needs a string instead of titleKeyinit .title
Multiple bindings
As mentioned earlier ,toggle Multi value binding is now supported , So let's look at an example . We will show from HomeSecurity The data structure of the use case begins .
struct HomeSecurity: Hashable, Identifiable {
var id = UUID()
var armed: Bool
var name: String
}
Let's add an extension to this structure and add some sample data to use :
extension HomeSecurity {
static var exampleData: [HomeSecurity] = [
.init(armed: false, name: "Garage Door"),
.init(armed: true, name: "Front Door"),
边栏推荐
- SQL 入门计划-1-选择
- [research materials] iResearch tide Watching: seven major trends in the clothing industry - Download attached
- Difference between redo and undo
- C # joint halcon Application - Dahua Camera Collection class
- list分割成满足和不满足条件的集合(partitioningBy)
- Process steps of vibrating wire acquisition module for measuring vibrating wire sensor
- Procédure de mesure du capteur d'accord vibrant par le module d'acquisition d'accord vibrant
- Interesting! Database is also serverless!
- Powerful, easy-to-use, professional editor / notebook software suitable for programmers / software developers, comprehensive evaluation and comprehensive recommendation
- Time series analysis using kibana timelion
猜你喜欢
解决VSCode下载慢或下载失败的问题
Hls4ml reports an error the board_ part definition was not found for tul. com. tw:pynq-z2:part0:1.0.
由浅入深学会白盒测试用例设计
[Mysql]安装Mysql5.7
Oracle physical architecture
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
面试题篇一
math_利用微分算近似值
渗透工具-TrustedSec 公司的渗透测试框架 (PTF)
Class loading mechanism
随机推荐
DS Transunet:用于医学图像分割的双Swin-Transformer U-Net
RichView TRVDocParameters 页面参数设置
Understand the structure in C language in one article
关于new Set( )还有哪些是你不知道的
Powerful, easy-to-use, professional editor / notebook software suitable for programmers / software developers, comprehensive evaluation and comprehensive recommendation
New window open page -window open
docker ubuntu容器中安装mysql遇到的问题
#yyds干货盘点#SQL聚合查询方法总结
How to add transactions in JDBC
Difference between redo and undo
Hls4ml/vivado HLS error reporting solution
开发那些事儿:EasyCVR集群设备管理页面功能展示优化
Example explanation: move graph explorer to jupyterlab
Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?
牛客编程题--必刷101之字符串(高效刷题,举一反三)
[Blue Bridge Cup web] analysis of the real topic of the 13th Blue Bridge Cup web university group match in 2022
list大集合等比分割成多个小list集合
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
Interesting! Database is also serverless!
P2433 [deep foundation 1-2] primary school mathematics n in one