We covered a huge amount of ground in this project, and you’ve learned about paths, shapes, strokes, transforms, drawing groups, animating values, and more. Not everyone will want to use all those features, and that’s OK – hopefully you have a clear idea of which parts interested you the most, and have some good coding experience with them.
If you combine your new-found drawing abilities with all the animation functionality we covered back in project 6, I hope you’re starting to realize just how much power and flexibility SwiftUI gives us. Yes, you can of course create whole apps using
NavigationView, and similar, but you can also build completely custom user interfaces that look fantastic and are just as fast.
Anyone can sit through a tutorial, but it takes actual work to remember what was taught. It’s my job to make sure you take as much from these tutorials as possible, so I’ve prepared a short review to help you check your learning.
One of the best ways to learn is to write your own code as often as possible, so here are three ways you should try extending this app to make sure you fully understand what’s going on.
Arrowshape – having it point straight up is fine. This could be a rectangle/triangle-style arrow, or perhaps three lines, or maybe something else depending on what kind of arrow you want to draw.
ColorCyclingRectangleshape that is the rectangular cousin of
ColorCyclingCircle, allowing us to control the position of the gradient using one or more properties.
Hacking with Swift+ subscribers can get a complete video solution for this checkpoint here: Solution to Drawing. If you don’t already subscribe, you can start a free trial today.
Tip: Gradient positions like
.bottom are actually instances of
UnitPoint, and you can create your own
UnitPoint instances with X/Y values ranging from 0 to 1.
SPONSORED With Sentry’s error and performance monitoring for iOS, you see mobile vitals that actually matter, can solve any latency issues quickly, and learn how each release is performing over time.
Link copied to your pasteboard.