Skip to content

Commit e5053ca

Browse files
committed
100 Days of SwiftUI - Days 23 and 24
Project 3 Challenge #3 - Go back to project 2 and create a FlagImage() view that renders one flag image using the specific set of modifiers we had.
1 parent d53c4ce commit e5053ca

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ Challenges are available inside [`SwiftUI`](SwiftUI) directory. (🚧 Still in p
3838
[swift_current_day]: https://www.hackingwithswift.com/100/65
3939
[swift_progress]: https://img.shields.io/badge/100%20Days%20of%20Swift-65-D64D42
4040

41-
[swiftui_current_day]: https://www.hackingwithswift.com/100/swiftui/22
42-
[swiftui_progress]: https://img.shields.io/badge/100%20Days%20of%20SwiftUI-22-3463DA
41+
[swiftui_current_day]: https://www.hackingwithswift.com/100/swiftui/24
42+
[swiftui_progress]: https://img.shields.io/badge/100%20Days%20of%20SwiftUI-24-3463DA

SwiftUI/Projects/GuessTheFlag/GuessTheFlag/ContentView.swift

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77

88
import SwiftUI
99

10+
struct FlagImage: View {
11+
var imageName: String
12+
13+
var body: some View {
14+
Image(imageName)
15+
.renderingMode(.original)
16+
.clipShape(Capsule())
17+
.overlay(Capsule().stroke(.black, lineWidth: 1))
18+
.shadow(color: .black, radius: 2)
19+
}
20+
}
21+
1022
struct ContentView: View {
1123
@State private var countries = [
1224
"Estonia", "France", "Germany", "Ireland", "Italy",
@@ -41,11 +53,7 @@ struct ContentView: View {
4153
Button(action: {
4254
self.flagTapped(number)
4355
}) {
44-
Image(self.countries[number])
45-
.renderingMode(.original)
46-
.clipShape(Capsule())
47-
.overlay(Capsule().stroke(Color.black, lineWidth: 1))
48-
.shadow(color: .black, radius: 2)
56+
FlagImage(imageName: self.countries[number])
4957
}
5058
}
5159

SwiftUI/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- [Day 20 - Project 2, Part One](#day-20---project-2-part-one)
2828
- [Day 21 - Project 2, Part Two](#day-21---project-2-part-two)
2929
- [Day 22 - Project 2, Part Three](#day-22---project-2-part-three)
30+
- [Days 23 and 24 - Project 3](#days-23-and-24---project-3)
3031

3132
</details>
3233

@@ -189,3 +190,11 @@ and an output unit, then enter a value, and see the output of the conversion.
189190
3. When someone chooses the wrong flag, tell them their mistake in your alert message.
190191

191192
[Code](Projects/GuessTheFlag)
193+
194+
## [Days 23](https://www.hackingwithswift.com/100/swiftui/23) and [24](https://www.hackingwithswift.com/100/swiftui/24) - Project 3
195+
196+
*Challenge*
197+
198+
1. Create a custom `ViewModifier` (and accompanying `View` extension) that makes a view have a large, blue font suitable for prominent titles in a view. [Code](Projects/ViewsAndModifiers)
199+
2. Go back to project 1 and use a conditional modifier to change the total amount text view to red if the user selects a 0% tip. [Code](Projects/WeSplit)
200+
3. Go back to project 2 and create a `FlagImage()` view that renders one flag image using the specific set of modifiers we had. [Code](Projects/GuessTheFlag)

0 commit comments

Comments
 (0)