Thinking in Swift, Part 3: Struct vs. Class
Continuing my “Thinking in Swift” article series, today we’ll do a simple change that will simplify our code again: using a
Thinking in Swift, Part 2: map those arrays
In part 1 of this article series, we saw how to avoid force-unwrapping optionals, save ponies 🐴 and avoid crashes by doing so. In this part 2, we’ll refine our code to make it Swift-er, introducing
Thinking in Swift, Part 1 — Addendum: Sacrificing ponies
After publishing part 1 of my article series “Thinking in Swift”, I had some great feedback and reactions on Twitter. Today I wanted to build on those comments and talk about when it could be ok to use
! and sacrifice a pony 🐴.
Thinking in Swift, Part 1: Saving ponies
I often see newcomers to Swift try to translate their ObjC code into Swift. But the hardest thing when starting to code in Swift is not the syntax, but changing your way of thinking, to use the new Swift concepts which were unknown to ObjC.
In this article series, we’ll take an example of ObjC code and walk thru converting it to Swift, introducing more and more concepts along the way.
Fun with Functions
Today’s article is about doing some fun with Swift functions, like functions returning functions, currying and operators on functions.
URLs and Pattern Matching
Today’s goal is to parse URLs like
http://mywebsite.org/customers/:cid/orders/:oid so that we can determine it’s a customer’s order request and extract the order #
oid and customer #
cid from it.
We’re gonna try and do that in an elegant way, using pattern matching and variable binding.
Enums as constants
Use enums as constants for your images, colors, storyboards, and more… and make your code beautiful (and short, and with autocompletion, and error-free)
Swift enums for JSON parsing
When your JSON contains string fields that can only contain a limited set of values, Swift enums and their ability to have String raw types can be very handy.
Welcome, Swift devs!
There we are, I finally decided to start a blog… but what to blog about?