This post is based on a lightning talk I gave at CocoaConf San Jose a couple of days ago. It's that time of year-- the time when summer time, or "Daylight Saving Time" as we for some reason call it in the USA-- is ending. That time when a developer's thoughts turn to date math and what a pain in the ass it can be. Why is this so hard to get right? It'd be nice to think that dates and times follow predictable routines whose cycles all use nice round (or at least consistent) numbers. However: The universe doesn't care about regular numbers. The length of a year doesn't divide into an integer number of days. Convenient time periods like months are no better. The Earth's rotation isn't entirely consistent. So we have leap years, and leap…read more →
Category Archives: Swift
One of the cool things UIStackView can do for you is make it easy to dynamically update your app's user interface while it's running, with smooth animations and not a lot of code. My recent talk at iOSDevCamp DC covered some techniques. Natasha the Robot wrote a couple of great posts based on my talk, and today I'm going to talk about another unexpected (to me?) use of stack views. Animated Updates with Stack Views Stack views exist to figure out the layout constraints for their arranged subviews. But only for the stack views that are visible. It might seem obvious but stack view layouts don't consider subviews that don't appear on the screen. The great thing about this is that you can dynamically update your UI just by changing the value…read more →
As I mentioned in my last post, last week I did a talk at iOSDevCamp DC where I talked about UIStackView, a relatively new UIKit class that's my new favorite thing in iOS development. I'm going to cover some of the more useful things UIStackView can do in posts here, which will fall more or less into two categories: Simplified and flexible UI design, making common UI patterns easier to implement and modify. Dynamic UI updates when apps are running, including UI animations and updates triggered by size class changes. Today I'll hit point #1 above. The cool, useful thing is this: Stack views make (most of) your autolayout constraints unnecessary, for common linear UI layouts. Side by Side Comparison So let's take a look at what UIStackView…read more →
Last week I did a talk at iOSDevCamp DC, an annual event hosted by Luis de la Rosa. I talked about UIStackView, under the admittedly grandiose title of "Mastering UIStackView". I've used stack views for a number of things recently, as I've come to realize they're a lot more useful than a lot of introductory material might suggest. I'll be writing about some of this in the very near future, but in the meantime the excellent Natasha the Robot has already done two blog posts based on stuff that I covered: The Easy Button: A Fancy Animation with StackView Magical View Rotation with StackView Sometimes when I do a technical talk I wonder if people really took anything away from it. Other times, someone does two great blog posts based on the…read more →
A large part of the Swift Standard Library is concerned with Generators, Sequences and Collections and functions that operate on them, so it’s pretty important to have a good understanding of them.
I was going to write a blog post about how to create and use Swift generators and sequences. But while I was trying to understand them myself, I found this post over at iOSDeveloperZone.
Go read that, and pretend that I wrote something as helpful.permalink