mirror of
https://github.com/1SecondEveryday/MemoryTree.git
synced 2026-03-25 08:55:47 +00:00
Add a leafier tree with animals
This commit is contained in:
parent
435c8a40c5
commit
4354a5dd56
3 changed files with 37 additions and 4 deletions
21
MemoryTree/Assets.xcassets/TreeLeafierAnimals.imageset/Contents.json
vendored
Normal file
21
MemoryTree/Assets.xcassets/TreeLeafierAnimals.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "TreeLeafierAnimals.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
MemoryTree/Assets.xcassets/TreeLeafierAnimals.imageset/TreeLeafierAnimals.png
vendored
Normal file
BIN
MemoryTree/Assets.xcassets/TreeLeafierAnimals.imageset/TreeLeafierAnimals.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 355 KiB |
|
|
@ -35,10 +35,12 @@ struct ContentView: View {
|
|||
var treeImageName: String {
|
||||
if entries.isEmpty {
|
||||
return "TreeBare"
|
||||
} else if entries.count < 3 {
|
||||
} else if entries.count < 3 { // 1-2
|
||||
return "TreeLeafy"
|
||||
} else {
|
||||
} else if entries.count < 5 { // 3-4
|
||||
return "TreeLeafier"
|
||||
} else { // 5+
|
||||
return "TreeLeafierAnimals"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +87,7 @@ struct ContentView: View {
|
|||
isEditing.toggle()
|
||||
} label: {
|
||||
Image(treeImageName)
|
||||
.renderingMode(.template)
|
||||
.renderingMode(entries.count > 0 ? .original : .template)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.foregroundColor(.white)
|
||||
|
|
@ -134,11 +136,21 @@ struct ContentView_Previews: PreviewProvider {
|
|||
|
||||
ContentView(entries: [
|
||||
Entry(text: "Coffee"),
|
||||
Entry(text: "Marion berries"),
|
||||
Entry(text: "Burritos"),
|
||||
Entry(text: "Mountains"),
|
||||
])
|
||||
.previewDisplayName("Leafier")
|
||||
|
||||
ContentView(entries: [
|
||||
Entry(text: "Coffee"),
|
||||
Entry(text: "Burritos"),
|
||||
Entry(text: "Mountains"),
|
||||
Entry(text: "Trees"),
|
||||
Entry(text: "Clean Water"),
|
||||
])
|
||||
.previewDisplayName("Leafier with Animals")
|
||||
}
|
||||
.tint(.white)
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue