Fuzz Buzz in bunt
This commit is contained in:
parent
57c56a4235
commit
cd16b94917
3 changed files with 20 additions and 12 deletions
|
|
@ -13,17 +13,28 @@ struct RangeView: TabContent {
|
||||||
|
|
||||||
@State var texte: [String]
|
@State var texte: [String]
|
||||||
|
|
||||||
|
func farbe(for i: Int ) -> Color {
|
||||||
|
return i % 3 == 0 ? Color.green : Color.yellow
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List(2...16, id: \.self) { i in
|
LazyHGrid(rows: [GridItem(.adaptive(minimum: 120))]){
|
||||||
HStack(spacing:0){
|
ForEach(2...16, id: \.self) { i in
|
||||||
|
ZStack{
|
||||||
|
if i % 4 == 0{
|
||||||
|
Circle().fill(farbe(for: i))
|
||||||
|
} else {
|
||||||
|
RoundedRectangle(cornerRadius: 25).fill(farbe(for: i))
|
||||||
|
}
|
||||||
|
VStack(spacing:0){
|
||||||
Text("\(i)")
|
Text("\(i)")
|
||||||
|
|
||||||
if i.isMultiple(of: 3) { Text("Fizz")}
|
if i.isMultiple(of: 3) { Text("Fizz")}
|
||||||
|
if i.isMultiple(of: 4) { Text("Buzz")}
|
||||||
if i.isMultiple(of: 5) { Text("Buzz")}
|
}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -20,9 +20,6 @@ struct UnicycleView: View {
|
||||||
Text("Einrad von \(uni.createdAt.description)")
|
Text("Einrad von \(uni.createdAt.description)")
|
||||||
}.onDelete {
|
}.onDelete {
|
||||||
for index in $0 {
|
for index in $0 {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
modelContext.delete(unis[index])
|
modelContext.delete(unis[index])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue