Skip to content

Instantly share code, notes, and snippets.

@Kilo-Loco
Created June 28, 2020 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kilo-Loco/935c20ab06cf212e3f451635c5b84c1c to your computer and use it in GitHub Desktop.
Save Kilo-Loco/935c20ab06cf212e3f451635c5b84c1c to your computer and use it in GitHub Desktop.
Show faceoff teams
struct TeamFaceOffView: View {
let teams = Animal.all
var body: some View {
List {
let indecies = Array(0 ..< teams.count)
.filter { $0.isMultiple(of: 2) }
ForEach(indecies, id: \.self) { index in
let leftTeam = teams[index]
let rightTeam = teams[index + 1]
HStack {
Text(leftTeam.name)
Spacer()
Text(leftTeam.icon)
Text("9:00")
Text(rightTeam.icon)
Spacer()
Text(rightTeam.name)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment