for example :how to change the image border color when i click a button
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
swiftUI:how to get button enabled until all checkbox get checkedhere is my code:i want get button(logout) enabled until checkbox(check1~check5) all checkedCheckView.swift:import SwiftUI
struct CheckView: View {
@State var isChecked:Bool = false
var title:String
var count:Int = 0
func toggle(){isChecked = !isChecked}
var body: some View {
HStack{
Button(action: toggle) {
Image(systemName: isChecked ? "checkmark.square" : "square")
}
Text(title)
}
}
}
#if DEBUG
struct CheckView_Previews: PreviewProvider {
static var previews: some View {
CheckView(title:"Title")
}
}
#endifExitCheckListData.swift:import Foundation
let exitCheckListdata = [
ExitCheckListItem(id:0,title: "check1"),
ExitCheckListItem(id:1,title: "check2"),
ExitCheckListItem(id:2,title: "check3"),
ExitCheckListItem(id:3,title: "check4"),
ExitCheckListItem(id:4,title: "check5")
]ContentView.swift:List(exitCheckListdata){ item in
CheckView(isChecked: item.isChecked, title: item.title)
}
.font(.title)
Button(action: {
}) {
Text("logout")
}