当前位置:网站首页>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"),
边栏推荐
猜你喜欢
![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled]
![[research materials] national second-hand housing market monthly report January 2022 - Download attached](/img/c8/a205ddc2835c87efa38808cf31f59e.jpg)
[research materials] national second-hand housing market monthly report January 2022 - Download attached

Interesting! Database is also serverless!

开发那些事儿:EasyCVR平台添加播放地址鉴权功能

EURA欧瑞E1000系列变频器使用PID实现恒压供水功能的相关参数设置及接线

运动捕捉系统原理

windows环境 redis安装和启动(后台启动)

Review the collection container again

ModSim基本使用(Modbus模拟器)

EasyCVR通过国标GB28181协议接入设备,出现设备自动拉流是什么原因?
随机推荐
RichView TRVDocParameters 页面参数设置
switch 有四样写法你知道么
Summary of SQL aggregate query method for yyds dry goods inventory
qobject_cast用法
开发那些事儿:EasyCVR平台添加播放地址鉴权功能
Flask 常用组件
Oracle physical architecture
Interview question 1
【多线程】锁策略
Class loading mechanism
Solve the problem of slow or failed vscode download
简单但现代的服务器仪表板Dashdot
Cookie和Session的相关概念
【蓝桥杯Web】2022年第十三届蓝桥杯Web大学组国赛真题解析
JS的Proxy
Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
独家消息:阿里云悄然推出RPA云电脑,已与多家RPA厂商开放合作
What if win11 can't pause the update? Win11 pause update is gray. How to solve it?
What if the win11 shortcut key switching input method doesn't respond? Shortcut key switching input method does not respond
2022/5/23-2022/5/30