View
//消除列表两边空白
.listRowInsets(EdgeInsets())
//设置显示宽高比例
.aspectRatio(7/3,contentMode: .fit)
//设置圆角
.clipShape(RoundedRectangle(cornerRadius: 25.0))
//监听数据变化
.onChange(of: index, perform: { value in
print(value)
})
//视图自动生成占位符
.redacted(reason: .placeholder)
//图片自适应展示
Image.resizable()
//是否隐藏导航栏
.navigationBarHidden(true)
//导航跳转页面
NavigationLink(destination: Text("LOGIN11"), isActive: $showLogin) {
Text("")
}
Timer
计时器
定时触发器
private let timer = Timer.publish(every: 3, on: .current, in: .common).autoconnect()
view.onReceive(timer, perform: { _ in
//业务代码块
})