100 Days of SwiftUI Day 88

100 Days of SwiftUI – Day 88

We’ve arrived at day 88 of the 100 Days of SwiftUI! Yesterday, learned how to trigger code by using Timer. Today, we’re looking into designing a single card view and building a stack of cards. Sounds interesting, so let’s dive in right away!

Designing a single card view

In this project we want users to see a card with some prompt text for whatever they want to learn, such as “What is the capital city of Scotland?”, and when they tap it we’ll reveal the answer, which in this case is of course Edinburgh.

Hacking with Swift, Paul Hudson (@twostraws)

Before we start, we have to brainstorm and think about what our card should display and what data it should work with. This will define how we’ll design and create this card. For this project, we’ll be asking a question and expect an answer, so those are the two pieces the card will hold and display.

Building a stack of cards in SwiftUI

After we’ve built a single card, the goal is to replicate that card and make multiple to form a stack. Each holding a different question and answer, of course. Right now, we don’t have any way of adding a card, but SwiftUI features helpful functions and methods to accomplish this.

Wrap up

And that’s it for day 88! Tomorrow, we’ll look at how to color views as we swipe, as well as counting down with a timer. It’s no fun if you have infinite time, right? Stay tuned for that and see you tomorrow!

Darryl

Hi! My name is Darryl and this is my personal blog where I write about my journey as I learn programming! You'll also find articles about other things that interest me including games, tech and anime.

Post navigation

Leave a Comment

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

100 Days of SwiftUI – Day 7 – Functions

100 Days of SwiftUI – Day 82

100 Days of SwiftUI – Day 87

100 Days of SwiftUI – Day 23 -Views and Modifiers