Swift Regex Deep Dive
iOS MacOur introductory guide to Swift Regex. Learn regular expressions in Swift including RegexBuilder examples and strongly-typed captures.
I love teaching the Big Nerd Ranch Advanced iOS bootcamp. There is always something new to learn from the students. We figure out a lot of things together during the week, through projects I assign and through questions the students bring with them. But my class last week had an extra surprise for me: mutiny!
The mutineers and me.
In each of my advanced classes, we do a mini hackathon using what we’ve learned. I tell the students early in the week, but don’t give them the details until the morning of the challenge. We have a small API, and a project outline (much like you might get from an inexperienced consulting client). Teams are free to design the app however they want, within a few constraints.
However, this class included several people who are already quite confident with web services. They were anxious to do more with core graphics and animations. We’d covered those topics we earlier in the week, but we don’t always get the chance to play with them when developing real projects. So one of the students advocated for a new project, one where they would create a drawing app instead.
Despite my military background, I didn’t summarily execute the mutineers. Instead, I was all for improvisation and a change of plans. Who doesn’t love a good drawing app? (I certainly do. My favorites: Paper, Sketch Club, Procreate.) Besides, I wrote some of the Big Nerd Ranch material on animations, so I was happy to see students embrace transitions.
We agreed on new guidelines. Then the class split into two teams. One team grabbed the whiteboard and held a whispered session, then split up to work on separate parts of their app. The other opted for a pair programming approach, with the whole team gathered around two computers for much of the jam. I love the buzz in the room every time I start one of these events: all the training from the week comes alive in this moment, when there is little time and big goals.
The teams traded a few jabs, but soon settled into a pattern of quiet reading and research, bursts of typing, exclamations of failure or success, then more typing. When I wasn’t busy helping the teams diagnose or debug issues, I decided to make an app of my own. There were a few questions from the week that I’d wanted to answer with code samples, so I picked something that I could use to show off iOS 7 translucency, as well as some extra Auto Layout examples.
In just a few hours, both teams built simple drawing apps and even included some fun effects (one was an accidental feature, but still cool). It was also a powerful learning experience, and a chance to exercise APIs that we don’t always get to play with while building the guts of a modern app.
Team frontline (the front row of the class) had Facebook sharing built in as a last-minute bonus feature. They had the ability to change colors and pen thickness while drawing, and even showed off this sample image:
I should note that we’re developers, not artists. This is great work for an app developed from scratch in a few hours!
Team backrow (the back … well, you’ve figured it out) included a collection view with different animated transitions to and from the drawing view. They had a color mixer (courtesy of Stack Overflow, if I remember right), as well as undo and redo. Perhaps most impressive (if less useful) was the particle emitter you could turn on while drawing. Fun!
As for my own project, I had a remote control on my iPad. It turned on a collection view that was shown on a second screen (an Apple TV, in our case). I then had a translucent panel I could turn on or off that overlaid the collection view.
Big Nerd Ranch’s bootcamps are intense and hard, but they are also a lot of fun. Thanks, class, for a great week. To the rest of you, I hope to see you in a bootcamp soon!
Our introductory guide to Swift Regex. Learn regular expressions in Swift including RegexBuilder examples and strongly-typed captures.
The Combine framework in Swift is a powerful declarative API for the asynchronous processing of values over time. It takes full advantage of Swift...
SwiftUI has changed a great many things about how developers create applications for iOS, and not just in the way we lay out our...