[SC]()

iOS. Apple. Indies. Plus Things.

> Swift Articles|

Explore Swiftjective-C's Swift writing on language fundamentals, concurrency, debugging, Codable, and practical implementation details drawn from shipping Apple-platform apps.

39 articles tagged Swift

  • Swift enums are among the most flexible tools available in the language. Using them as lightweight view models is a delight.

  • Sometimes, you just want some leniancy with codable. Here's how I get it.

  • Sometimes, you just need to persist some dumbed down data. Here's a few ways to do it.

  • Swift has a useful mechanism to generate random values. Today, let's see how we can plug in `SystemRandomNumberGenerator` for our own types.

  • It's not a groundbreaking pattern, but it pays to mask third-party code. Here's how I do it.

  • Codable is impressive, but it bails out quickly if .json doesn't appear exactly how it expects. Here's how I cleaned things up to pinpoint errors quickly.

  • Morphology, or for mere humans - the study of the many forms of words, is ripe with interesting programming applications. Let's take a look at a few of them.

  • The world lives on API responses. That means, we live in Codable modeled off JSON, so here's how I quickly built models using pretty printed String dumps.

  • Every codebase under the sun on God's green earth uses print statements to wrangle bugs. Let's look at the tools that Swift has for such cases.

  • Another core piece of functionality arrived in Swift 5.1 - built in diffing. Let's take a look.

  • NS_CLOSED_ENUM in Swift

    Enumerations provide clarity and intent. Some change and yet others remain stagnant, and now we program effectively for either case.

  • Attributes can keep code clean and conscise without much effort. Today, let's cover some common, and uncommon, use cases.

  • Swift Keywords in Swift

    Swift has quite a few keywords. Let's look at every single one, what it does and provide a code sample.

  • NS_SWIFT_NAME in Swift

    Interop is required in the world we live in. Here's an attribute in Swift that can help make things easier.

  • noescape in Swift

    It's an attribute you've seen hanging over closures. Let's dive into what it means, or more specifically - meant.

  • The Swift Stand Library offers up several differeny ways to work with arrays. From sorting to sifting, almost every use case is covered efficiently.

  • More than just an anonymous function, Swift's closures are extremely versatile. One such use case for them is initialization.

  • #keyPath in Swift

    Selectors are a part of iOS development daily. They can also be a common source of frustrating bugs, but #keyPath is here to help.

  • Our favorite open source language is changing at a rapid pace. Here, we'll check out some of my favorite additions that landed in Swift 3.

  • Access Control in Swift

    Abstraction is a tent pole component of modern programming. Swift's robust tooling for access control can help us enforce it.

  • A Swift Refactor in Swift

    Swift offers us several novel ways to refactor our code. Follow along as we embark on such a task on some fictional code.

  • ARC in Swift

    Automatic reference counting debuted several years ago and ushered in a new era of memory management. But, how does it work with Swift?

  • Initialization in Swift

    If you're coming from Objective-C or are new to Swift, the way its initialization works can be confusing. Diving into the particulars is a worthwhile effort.

  • It's possible to enhance a wide family of objects with protocol extensions. Today we'll try and see how its possible.

  • Option Set in Swift

    Option Sets solve a large swath of problems, but you may not think to use them at first. Looking at how they work and why their useful might change your mind.

  • Javascript in Swift

    Javascript and...Swift? It works better than you might think, and for more than just parlor tricks.

  • Error Handling in Swift

    Dealing with errors is usually a developer's favorite task to procrastinate against. But it shouldn't be, and even though Swift's inplementation is differnt - it's robust.

  • Guard in Swift

    More than an _if_ statement, this simple construct makes code safer and readable. But when do you use one or the other?

  • Defer in Swift

    More than an _if_ statement, this simple construct makes code safer and readable. But when do you use one or the other?

  • Pattern Matching in Swift

    Pattern matching with Swift yields concise code when it otherwise might be a bit more convoluted. Here's how it works.

  • The infamous WWDC session introduced us to 'Protocol Oriented Programming'. Really, though - what is it?

  • Swift goes to great lengths to ensure values are initialized before they are used. The reasons how vary from API design to the way LLVM works - let's chat about this process cal...

  • We've now hit the inflection point where your Objective-C projects must mix with Swift, or vice-versa. Here's how my first experience with it went.

  • bool in Swift

    The boolean variable, perhaps the most simple implementation in Computer Science - or is it? Swift's version can do more than just spit out 0 or 1.

  • set in Swift

    The array is a beautiful cornerstone of data structures, but sometimes we call upon its close cousin - the set. Here's how Swift's version works.

  • int in Swift

    Integers are used in almost every iOS app. With Swift, they've become even more useful.

  • It's one of the first thing green programmers learn - looping and iteration. Swift has made it easy and versatile.

  • Casting in Swift

    We'd all just as soon let the compiler do all the work, but sometimes casting is unavoidable. Here's how it can be used with Swift.

  • Tuples in Swift

    Tuples can be a short stand in for tiny data constructs. When used properly, they can make your code a bit more opportunistic.