Distributing closed-source frameworks with SPM

In this post, we’ll look at how to distribute closed-source XCFrameworks-based products with the Swift Package Manager (SPM). The information is based on a real product that I just launched and goes through project setup, package distribution and how to solve some problems along the way.

Swift Semantics

In this post, we’ll look at various ways to improve readability and writeability of Swift code by introducing extensions to Swift’s native types.

Uniquely identify the current device

In this post, we’ll look at how to uniquely identify the current device. We’ll look at different way of persisting the unique identifier to make it available even if the app is uninstalled.

Using the iOS keychain to persist data

In this post, we’ll look at how to read from and write to the keychain on iOS devices. We’ll look at a great library for this and how we can make it more abstract.

Url encode strings

In this post, we’ll discuss how to url encode strings. We’ll then create an extension that let’s us do this easier and with less code.

Case-sensitive String replace operations

In this post, we’ll discuss how to replace all occurences of a string within another string. We’ll then create an extension that allows for easier case-sensitive replacements.

Case-sensitive String contains checks

In this post, we’ll discuss how to check if a String contain another String. We’ll then create an extension that allows for easier case-insensitive checks.

Base64 encode and decode strings

In this post, we’ll discuss how to Base64 encode and decode strings in Swift. We’ll then create extensions that make this a lot easier and more readable.

Numeric string representations

In this post, we’ll create string representations of numeric types in Swift and extend these types with convenience functionality to make them easier to use.

Modify dates in Swift

In this post, we’ll extend Date with functions that let us add and remove seconds, minutes, hours and days to dates.

Bind view geometry data to bindable properties

SwiftUI is an amazing tool for building declarative user interfaces. However, it’s still young and lacks built-in ways to do many common things. In this post, we’ll look at a way to read geometry information from any view in a view hierarchy.

Building an Apple Watch app in SwiftUI

SwiftUI and Combine makes it amazingly easy to build apps for watchOS. However, if the app is part of a larger system, you may have to adjust your architecture. In this post, we’ll take a look at the work involved in building BookBeat’s SwiftUI/Combine-based app for Apple Watch.

Present delegating view controllers in SwiftUI

Presenting UIKit view controllers in SwiftUI is trivial, but things become more complicated when a controller communicates back through delegation. Since SwiftUI views are structs, they therefore can’t be delegates. In this post, we’ll look at one way to solve this.

SPM .gitignore excludes Xcode projects

When you create Swift Packages with swift package init, the generated .gitignore will exclude all Xcode projects by default. This will cause problems if you later add an Xcode project to your package.

Fix broken network in Catalina

In this post, I’ll show how to restore the network configuration in macOS Catalina beta 5, if it suddenly stops working. It happened to me and the solution was to just delete a couple of files.

Generic Swift protocols

For years, I’ve been struggling with combining generics and protocols in Swift. In this post, I’ll describe how I finally made sense of it all.

Constrain Swift extensions with protocols

I really love the Swift type system and its extension model. You have to use it with care, but combined with careful system design, they give you a lot of power. In this short post, I discuss how to keep your extensions from being exposed everywhere.

git grep

This is a short note to self about how to use git instead of grep to recursively find all occurrences of a certain text in all files within a root folder.

Using structs like enums

Swift enum and struct are two powerful tools. In this post, I’ll discuss how you typically use them and how to use structs like enums when you need more flexibility.

Coordinating async operations

Swift is an amazing language, but I find that it lacks good support for coordinating async operations in sophisticated ways. In this post, I will look at existing libraries for solving this problem, then discuss a lightweight alternative that uses a couple of simple protocols and implementations.

Sheeeeeeeeet 1.2

Sheeeeeeeeet 1.2 introduces a completely rewritten appearance engine that makes it easier to style and subclass your action sheets and their items. In this post, I’ll discuss some of the major changes.

iPad Pro production setup

In this post, I’ll write about my process to find a setup that lets me be more productive and flexible in how I work with my various sites, projects, blog etc. I will descibe how I moved away from my old hosting provider and Wordpress and how I finally found a setup that lets me create content on my iPad Pro.

Alamofire + AlamofireObjectMapper

This is an updated version of a talk I gave at CocoaHeads Sthlm in 2017 on how to use Alamofire to communcate with an api, AlamofireObjectMapper to map responses, the Alamofire RequestRetrier to automatically retry failing requests and the RequestAdapter to adapt all requests. I also demonstrated how to use Realm to seamlessly add offline support, using the decorator pattern.

Automate setting up Xcode

In this blog post, I will show how to automate setting up Xcode for you and your team, including setting up required tools, simplify enforcing common conventions etc. using Homebrew and Fastlane in a way that is easy to extend if you need to automate more tasks later on.

SwiftyDropbox crashes in Swift 4.2

After installing Xcode 10 yesterday, I started migrating some libraries to Swift 4.2. While most migrations were painless, one caused me some headache, since the library depends on SwiftyDropbox which does not yet support Swift 4.2.

Automate setting up macOS

In this post, I’ll describe how you can automate setting up a brand new Mac with a terminal script that will install system software, applications, configure the computer etc. This will help you setup a new Mac in minutes.

Mojave backslash keybinding

This year, I decided not to wait a while year before installing the latest macOS, so I grabbed it as a beta, installed it and didn’t look back. Before doing so, I also created a setup script that quickly can setup a clean computer from scratch. I am not that brave.

Codable magic

I have finally started replacing all NSCoding objects in my code with Codable. This post covers things that I’ve learned along the way.

Protocol array extensions not working

In an app of mine, I had an idea on how to redesign how we extend protocol-based domain models. However, what first looked like a walk in the park, turned into a Swift nightmare, with problems that I am still struggling with.

Ditching RxSwift

After hearing so many good things about RxSwift and not having the opportunity to try it at work, I decided to use it when I rewrote an old app of mine.

A Swift Playgrounds Evening

Tonight, I finally sat down with my oldest daughter Cornelia, to play with Swift Playgrounds and try to teach her a bit about programming.

Using iPad Pro with Working Copy

In this post, I will write about my experience using Working Copy on my iPad Pro, adding a blog post to a Jekyll-powered blog, then pushing the result to GitHub.

git autocompletion in OS X Terminal

After procrastinating for too long, I finally spent a minute of my life to setup git autocomplete in the macOS terminal. The original discussion on this topic is found here.

New year, new habits

I finally made it! After years and years of “I really shouldn’t”, I have finally managed to abandon my old hosting provider and move all my sites to GitHub.

.NET Core notes to self

I have been playing around with .NET Core since the early betas, but since I do so with rather long times in between, things break each time I decide to pick up from where I started.

Ionic 2 - Build Configuration-Specific Settings

In an Ionic 2 app that I am building for iOS and Android, I want to use different application settings for different build configurations. For instance, I want to use different api endpoints for development and production apps, disable tracking for development apps, disable logging for production apps etc.

Upgrade .NET Core RC to 1.0

With the release of Visual Studio Code 1.0, I decided to upgrade .NET Core to the latest version. However, the older version was not properly replaced when upgrading, which did cause Visual Studio Code and Omnisharp to behave quite strange.