Blog

show all ·  general swift swiftui ·  ai android api apps ar async authentication automation ci-cd closed-source codable colors conferences css dates dependency-injection device di docc documentgroup emojis environment-values error-handling extensions gamedev geo gestures git github guest-article html hybrid-apps iap images ioc ios javascript jekyll keyboard keychain licenses linting localization macos mapkit mocking multi-platform open-source pasteboard protocols realm rich-text scrollview searchable sf-symbols spm storekit subscriptions swiftgen tagging testing tvos typography video vr watchos web xcode

Xcode stops fetching Swift packages

Nov 4, 2024

Today, Xcode 16.1 suddenly stopped fetching Swift package dependencies, with a Fatal: cannot use bare repository warning. Let’s see how to fix it, in case it starts happening to you.

The (too?) complex state of Emojis in 2024

Aug 13, 2024

Let’s take a look at the Emoji standard’s support for skin tone, gender, and direction variants, and how it may have reached its peak as Apple for the first time has removed emojis in iOS 17.4.

Reflections on failing to reach out

Nov 8, 2023

My last month has been all about wrapping up and releasing a brand new major version of KeyboardKit. It has been a fun project…but failed to deliver on all the work that went into it.

Cleaner grid initialization in SwiftUI

Aug 29, 2023

SwiftUI’s LazyVGrid and LazyHGrid are great for creating flexible grids. I however always find myself struggling with their initialization and have therefore created some utilities.

SwiftUI Prefers Semantics

Jun 15, 2023

SwiftUI get amazing updates every year. If you however have to support old OS versions, you may be unable to use the new tools, or jump through hoops to make it work.

DeckKit Updates

Jun 13, 2023

DeckKit 0.7 is out, with new shuffle support that makes shuffling a deck enjoyable. Let’s take a look at what’s new in this minor update.

SwiftUIKit Updates

Jun 12, 2023

SwiftUIKit 3.3 is out with some additions, like support for using Codable with AppStorage and SceneStorage, as well as new list utils. Let’s take a look at what’s new in this update.

Vision Pro - so many questions

Jun 5, 2023

Apple Vision Pro is finally unveiled! As a surprise to no one, it looks spectacular. However, for every rumor and question addressed today, new ones arised.

An App Group roller coaster ride

May 17, 2023

I’ve been struggling with a random bug when using an App Group to sync data between an app and a keyboard extension. The explanation: a combination of human error and Xcode.

Deep Dish Swift - Day 3

May 2, 2023

Deep Dish Swift flew by and suddenly, the third and final day was here…way to soon. I’m impressed by the scale of this first edition, and hope there will be a second one next year.

Deep Dish Swift - Day 2

May 1, 2023

Deep Dish Swift Day 1 was one afternoon filled with amazing talks and getting the chance to meet many people from the community. Let’s get Day 2 going.

Deep Dish Swift - Day 1

Apr 30, 2023

2023 flew by and Deep Dish Swift suddenly happened! This is a summary of the first indie dev day. The talks are not recorded, so invite the speakers to your conference.

Sort git tags like a pro

Mar 26, 2023
git

If you like me use semantic versioning and have projects with a gazillion version tags, it’s nice to be able sort the tags in various ways. Let’s see how to sort Git tags like a pro.

Introducing LicenseKit

Nov 9, 2022

When building closed-source software, you must protect your source code as well as the binaries themselves. One way to do this is with software licenses. This is why I’m excited to introduce LicenseKit - an SDK that protects your software with commercial licenses.

Using QuickLook in SwiftUI

Jun 27, 2022

SwiftUI is growing with every release, but there are still old treasures to be found in various frameworks, that aren’t part of core SwiftUI. Let’s take a quick look at QuickLook!

Custom sheet sizes in SwiftUI

Jun 15, 2022

WWDC’22 introduced many amazing additions to SwiftUI, of which many will render many 3rd party libraries obsolete. One such is SwiftUI’s new support for custom sheet sizes.

Slugify a string

May 30, 2022

In this post, we’ll take a quick look at how to slugify a string in Swift, which is nice if you want to generate tags, web urls etc.

Detecting SwiftUI's preview mode

May 27, 2022

In this article, we’ll take a look at how to determine if code is running in a SwiftUI preview, which may be nice if you need to disable certain things, like network calls.

Git tags cheat sheet

Aug 26, 2021
git

In this post, let’s look at some git commands that I find useful. The post is primarily meant for future reference for myself, but can hopefully be useful to others as well.

Swift Semantics

Oct 16, 2020

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

URL-encoding strings in Swift

Jun 4, 2020

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

View controller delegation in SwiftUI

Jan 31, 2020

Presenting UIKit view controllers in SwiftUI is simple, but things become more complicated when they communicate through delegation. In this post, we’ll look at a way to solve this.

SPM .gitignore excludes Xcode projects

Jan 2, 2020

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

Generic Swift protocols

Apr 5, 2019

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.

git grep

Mar 11, 2019
git

This is a short note to my future self on how to use git grep instead of grep to find all occurrences of a certain text in all files within a git repository folder.

Using structs like enums in Swift

Jan 30, 2019

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

iPad Pro production setup

Dec 28, 2018

In this post, I’ll write about findung a more flexible setup for my various sites, projects, blog etc. I’ll descibe how I moved away from my old hosting provider and Wordpress and found a setup that lets me create content on my iPad Pro.

Alamofire + AlamofireObjectMapper

Dec 27, 2018

This is an updated version of a talk I gave at CocoaHeads Sthlm in 2017, on how to use Alamofire to talk with an api, AlamofireObjectMapper to map responses, the Alamofire RequestRetrier to retry failing requests and the RequestAdapter to adapt all requests.

Automate setting up macOS

Aug 26, 2018

In this post, I’ll describe how to automate setting up a new Mac with a terminal script that will install system software and applications, configure the computer etc. in mere minutes.

Codable magic

Feb 15, 2018

I have finally started replacing NSCoding types in my code with the new Codable protocol. This article covers things that I’ve learned along the way.

Ditching RxSwift

Jan 19, 2018

After hearing many good things about RxSwift, I decided to use it in an app. However, after struggling with it for months, I haven’t found a nice setup and have now decided to ditch it.

Using iPad Pro with Working Copy

Nov 5, 2017

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.

New year, new habits

Jan 23, 2017

I finally made it! After years of “I really should”, I have finally left my old hosting provider, move all my sites to GitHub and start with some nice new habits for the new year.

Reset Xcode load plugin bundles warning

Sep 5, 2016

I accidentally clicked “Skip Bundles” instead of “Load Bundles” when I started Xcode after adding new plugins. This causes Xcode to not load plugins. How can we fix this?

Using Swift protocols in Objective-C

Sep 3, 2014

I’m currently creating two games for iOS. One is made in Swift & SpriteKit, while one is in Objective-C & UIKit. I now want to share logic by using my Swift protocols in Objective-C.

Scaling mobile at Spotify

Nov 6, 2013

This is a sum-up of a talk I attended at Øredev 2013, where Mattias Björnheden and Per Eckerdal from Spotify talked about how Spotify scaled their mobile teams.

Memory leak in iOS when mixing ARC and non-ARC code

Sep 10, 2013
ios

I had an iOS app crash after taking a few photos. The stack trace showed a memory leak, but I had a hard time finding it. Turns out that it was caused by mixing ARC and non-ARC. When I tried reproducing it, I launched Instruments to see how the app allocates memory. I started taking photos, editing them, but didn’t encounter a memory leak…until I did.

Auto-increment Build Number in Xcode

Aug 23, 2013

When I released new version of iOS apps, I used to manually update the build number. It is however better to let Xcode do it automatically. Let’s take a look at how to do it.

Android Activity Lifecycle Car Analogy

Aug 5, 2013

In most application frameworks, classes have a lifecycle that is used to do customizations at the proper time. Let’s look at the Android activity lifecycle compared to a car.

Android Assets for Various Screen densities

Aug 2, 2013

Android devices come in many different flavors compared to iPhone devices. They can be slow, fast, crappy, great, low-res and ultra-hd. To best honor the device running your app, you should provide assets for various screen densities.

Android Fullscreen Activity

Aug 2, 2013

The best way for me to learn, is to write about it. This way, I can return to earlier posts and see that I knew nothing once, and that I have learned a few things. Today, I will honor that strategy by publishing a simple class that can be used for fullscreen Android activities.

Run Lint in Android Studio

Jul 31, 2013

As I just started learning Android, I was happy to see that linting is such an integral part of the development process. Let’s see how to set it up in Android Studio.

Android Glossary

Jul 31, 2013

I’m currently getting started with Android development, which means that I have many new things to learn. The biggest challenge with learning a new language is not the syntax itself, but the tools and conventions. Let’s look at some acronyms that are worth remembering.

Multiple SSH Files

Jun 7, 2013
git

When working with git, I use a single SSH key pair for GitHub, GitLab, etc. Today, though, I had to add a second key pair to be able to clone another remote repository.

New legal label in MKMapView

Apr 15, 2013

I used Google Maps in some of iOS apps, until Apple launched their own map engine. So, now I use Apple Maps. And it adds an annoying little label. Damn.

Oredev 2012 - Day 2

Nov 12, 2012

My second day at Øredev 2012 was amazing! When it was over, I had to sit down and take it all in. There were so many great talks, and I still had to skip many that I wanted to see.

Øredev 2012 - Day 1

Nov 7, 2012

I am happy to once again attend Øredev in Malmö, Sweden. Three days with great talks and nice friends is just what is needed in the dark, Swedish November.

iOS Bounce Animation

Sep 3, 2012
ios

I have an app where tapping various icons bounces the icon, plays a sound and takes the user to another part of the app. Let’s see how the bounce animation was made.

Localization in Objective-C

Aug 20, 2012

This post shows how to localize your iOS apps in several locales. I’ll will describe how to translate plain text and how to create localized versions of your storyboards.

JSON in iOS

Jul 4, 2012
ios

Working with JSON is easy in iOS 5, since there’s now a great, native JSON serializer and deserializer that handles everything for you.

Adding photos to the iPhone simulator

Mar 13, 2012
ios

I’m building an iOS app that makes use of the device camera. It works well, but since I’m also using the simulator, I want to be able to select pictures from the photo library as well.

Tweaking NDepend CQL rules

Oct 6, 2011

After learning how to automate and schedule NDepend to run for several solutions at once and starting to use NDepend more regularly, the power of CQL has grown on me.

Slow iMac about to be fixed?

May 12, 2011

I have been having big problems with my iMac 27″ (4GB RAM) that runs Windows 7 on a Boot Camp Partition (using VMWare Fusion), where it writes constantly and is super slow.

Trying out Plupload

Feb 2, 2011
web

The team behind Tiny MCE has created a great upload component called Plupload that supports many runtimes, such as from jQuery-based HTML uploads, Flash, Silverlight, etc.

HTML5 localstorage

Dec 9, 2010

I have spent some time experimenting with the new HTML 5 localStorage feature, which simplifies storing data in browser storage using JavaScript.

Getting started with git and GitHub

Oct 8, 2010
git

As some of my projects are coming together, I want to move them from Google Code to GitHub. Tonight, I decided to give it a try and say hello to git and GitHub.

Fonts.com web fonts

Sep 21, 2010

The time has finally come to throw Arial and Verdana into the trash (Helvetica can stay), as Monotype, Linotype & ITC have teamed up to develop a really cool service - web fonts!

Find the shortest path in a grid in XNA

Feb 22, 2010

I’m playing around with a board game engine in XNA, where players can play missions on a tile-based board. I’m now working on using the A* algorithm to find paths between tiles.

Load all assets in a folder in XNA

Jan 26, 2010

I have started looking at XNA and working on a small game. This post show how to load all assets in a folder, which is convenient for small games with not that many resources.

Using Moq with NUnit

Aug 19, 2009

As I continue to work with unit tests, I have noticed that some of my development patterns have started to change…for the better.

Twitter vs Jaiku

Apr 17, 2009

I’ve been trying out Twitter and Jaiku for a while now. Since both provide more or less the same set of features, I have evaluated which I think will best fit my needs going forward.

Avoid empty img src values

Jan 26, 2009

In this post, we’ll discuss how empty image src values can ruin the performance of a web site, and how you can to solve it.