Articles

Articles about code from Andrew Lord.
Android | Kotlin

Authorization and retrying of web requests for OkHttp and Retrofit

 ·  5 minute read

Most remote APIs require some form of authorization in order to access them. We will explore using OkHttp Interceptors and Authorizers to authorize our web requests for use with OkHttp and Retrofit.

iOS | Swift

Manage automation tasks using Swift Package Manager

 ·  7 minute read

To perform automation tasks on Swift projects, such as linting and code formatting, we often need to use command line tools or run scripts. Let's install them and manage it all with Swift Package Manager instead!

Android | Kotlin

The power of lazy properties in Kotlin

 ·  4 minute read

Kotlin makes creating properties that are initialized on first access very simple. We will go through different options for creating them and how they can be really useful in our Kotlin code.

Android | Kotlin

Uploading a file with progress in Kotlin

 ·  4 minute read

How to observe progress during a file upload may not be immediately obvious, when using Retrofit and OkHttp. We will build an implementation that uses a callback and then how to wrap it into a reactive stream.

Android | Kotlin

Protecting secrets in an Android project

 ·  7 minute read

Managing secret values in a way that doesn't make them easy to extract can be difficult. We will explore techniques we can apply to keep them out of source control and how to secure access to them.

Android | Kotlin

Enforcing type safety of IDs in Kotlin

 ·  3 minute read

Entities in our codebases will commonly need identifiers or IDs to refer to them with. We will have a look at the different options for them and how to make them type-safe, allowing our code to be safer and less error-prone.

Android | Kotlin

The power of sealed classes in Kotlin

 ·  5 minute read

Modelling a type that can come in different forms, each with their own state, is a really handy language feature. We will look into how and when Kotlin sealed classes can be used and look at some use cases for them!

Android | Kotlin

Using Kotlin to bind Android views

 ·  5 minute read

When retrieving views in Android there are many different ways to go about it. We will be looking at using both lazy delegated properties within Kotlin and the Kotlin Android Extensions to bind views to properties.

Android | Kotlin

Adding Continuous Integration to your Android project

 ·  6 minute read

CI is a powerful tool that can improve your workflow. We will explore some of the options available for Android, before configuring Circle CI and Bitrise in order to compare the approaches two different services take.

iOS | Swift

Clear and searchable logging in Swift with OSLog

 ·  6 minute read

Logging is a useful tool for diagnosing issues and working out what an app is doing. We will explore Apple's currently recommended way of logging via OSLog, covering how to use it and managing its differences when compared to other logging approaches.

iOS | Swift

Create Xcode file templates and share them with your team

 ·  4 minute read

When creating new files in Xcode the built-in templates often contain code we immediately delete or need to alter. We will explore the process of creating our own templates and how to go about sharing them with the rest of our team members.

Android | Kotlin

Testing on Android using JUnit 5

 ·  8 minute read

How we write and run unit tests can be greatly improved by using JUnit 5 on Android, which has been available for a while. We will look through what is required to get it setup and the changes it makes to how we write tests.