I have a simple array and would like to loop through it and replace all elements with false but am having a problem with the for in loop. An example of what I have done is below. I am new to Swift so any help with what the loop should look like would be sincerely appreciated.
struct ClubMembers {
var name: String
var active: Bool
}
func sampleMembers() -> [ClubMembers] {
let member1 = ClubMembers(name: "David", active: false)
let member2 = ClubMembers(name: "John", active: false)
let member3 = ClubMembers(name: "Mitchell", active: true)
return [member1, member2, member3]
}
forloop in the code you posted. Please show the code that you have tried and clearly explain what issues you are having.