It’s day 35 of the 100 Days of SwiftUI. Yesterday, we faced a difficult challenge day that I haven’t been able to complete yet. Today, we have a consolidation day. I’ve reviewed what we’ve learned and I’ve gone over a few key points.
Of course, we also have another SwiftUI challenge today, where we need to create a new app from scratch. Because I’m having trouble with yesterday’s challenge, I’ve decided to put this on hold for now and come back to this at a point later in time. Paul has given some great advice:
Remember, in SwiftUI all our views – and all our animations – must be a function of our state. That means we don’t tell the button to spin, but instead attach the button’s spin amount to some state, then modify that state as appropriate. Often this becomes frustrating, because we know where we want to get to but don’t know how to get there.
If this hits you during the course, just relax – it’s normal, and you’re not alone. If you’ve fought with something for an hour or two and can’t quite get it right, put it to one side and try the next project, then come back in a week or so. You’ll know more, and have had more practice, plus a fresh mind never hurts.Paul Hudson, Hacking With Swift (@twostraws)
Even though it’s been a few difficult days, I keep going over the material in order to solve the challenges myself. If it really won’t click, I’ll go over Paul’s solution, which will help me learn as well.
That’s it for now! We’ll back tomorrow with a new SwiftUI project to sink our teeth into. For now, it’s time to recharge and get ready!