Senior multiplatform engineer. If you're not a fan of equality we won't get on.

In Swift, I use the Result type extensively. Mostly for async callbacks, but it’s generally a nice, tidy and consistent way to provide a value that can either be a success or failure as a result of calling a function.

When I started learning Kotlin, I found that there is a Result type included (since Kotlin 1.3), but to my dismay you cannot (by default) use this class as a return value for a function.

I have never been happy with Kotlin’s built-in version of the Result type, anyway. Having to check if isSuccess or isFailure, null-check if the success or failure value exists or use the fold function seems archaic and not really necessary in neither Kotlin or Swift thanks to their generics. …


Image for post
Image for post
Photo by Mae Mu on Unsplash

Over the past few months I’ve been working on porting one of my native iOS apps to Android, and I’ve been learning a lot about how Android works as a platform.

I’m now far along enough into development that I’m starting to work on refining the UI, and one of my challenges has been to create a bottom sheet where some UI appears to “stick” to the bottom.

Image for post
Image for post
Sticky!

After a bit of research I couldn’t find a simple solution so ended up coming up with my own. …


Let me start off by saying I absolutely love Swift Package Manager and I think it’s the future of dependency management on iOS, so-much-so I’ve written posts on what we can do with it.

But I also want to use this opportunity to highlight a potential risk with using it that I became aware of today. I initially thought there was no issue tracker for Swift Package Manager since there isn’t one in the GitHub repo, but I’ve since reported this issue on the Swift bug tracking Jira instance (SR-13346).

I’ve found a way to run any code I want when you use one of my Swift packages (providing you don’t check the Package.swift file before hand), and it’s a lot simpler than you might think. …


Image for post
Image for post

Last year, after Apple released the first beta of Xcode 11 with native support for Swift Package Manager (SPM) built in, I wrote a post on how we can leverage this to build modular apps with Swift Packages.

In it, I touted that it would make it possible to ditch Cocoapods as a dependency manager, but what we ran into quickly was a limitation with being unable to include resources in a Package, like colour assets, fonts, storyboards/xibs etc.

Thankfully, Xcode 12 includes the latest version of SPM which now allows Packages to include any resources, by including a new static property on Bundle named .module. …


Image for post
Image for post
Photo by Fabian Grohs on Unsplash

I recently started my journey into Android development after creating iOS apps for 5 years, and there are a few things I wish I knew that tripped me up at the start.

In this post, I’ll go over 5 of them, so if you’re learning (or thinking about learning) Android as well, I hope this post helps you!

1. Views & ViewGroups

On iOS, views are represented as UIView subclasses, similarly on Android views are represented as View subclasses.

On iOS, you can add a UIView as a subview of any other UIView. On Android, you can only add a View as a subview (technically, child view) inside a ViewGroup (even though ViewGroup is actually a subclass of View). …


Image for post
Image for post
Photo by NASA on Unsplash

While Apple and Google work on a new cross-platform contact tracing API to help tackle the COVID-19 pandemic, we’re starting to see some countries release bespoke apps built using just the existing Bluetooth APIs on each platform.

What we’re quickly seeing in the media about these solutions is that the iOS app has some limitations while in the background (i.e. not the visible and active app), and as a result the creators of these apps are often recommending people leave the iOS app in the foreground, or that they work better if Android devices are nearby.

IMPORTANT: This post is not designed to call out any specific implementation by any country, nor should you as a reader be worried about downloading any of them! Although the general consensus is it’s better if countries used the Apple|Google framework, we should still use what is currently available until something potentially better is available. …


Because any app can read and write to the Health store on iOS and watchOS, (with permission from the user), it means that your app has to be ready to respond to changes made out of your app’s control.

This is a relatively new concept in iOS, since generally the sandbox environment apps run in gives you total control over everything that happens.

In this post I’ll focus specifically on a way to manually test HealthKit, which is especially useful if your app responds to events that other apps write to the shared store in the Health app on iOS (and watchOS). …


Okay, so I’m a bit behind, but how amazing are @propertyWrappers in Swift 5.1?!

Recap

Formerly called “property delegates”, property wrappers are just that. They’re a wrapper around a property, and they’re simpler to set up than you might expect.

A property wrapper is just a type annotated with @propertyWrapper :

@propertyWrapper
struct Wrapper {
var wrappedValue: Value}

And you use it on any property that has a type matching the wrappedValue type:

struct Thing {  @Wrapper
private var value: Value
}

It’s as simple as that, now when value is changed, it’s actually the wrappedValue that changes. This becomes powerful when you know that you can set a specific get and set, to be called when the wrapped property is retrieved or set. …


Image for post
Image for post

NOTE: Xcode 12 improves Swift Package Manager support for creating modular apps, so I’ve written a follow up post with how to use it.

Xcode 11 beta 1 is out, and it is extremely exciting! Until now, the best way to manage dependencies was with Cocoapods or Carthage, but today that changes.

Xcode 11 and Swift Package Manager make it ridiculously easy to make modular apps; Xcode 11 automatically resolves dependencies when you build, and even gives useful error messages!

I’ll show you how easy it is.

Step 1

In Xcode 11, create a new Workspace from File > New > Workspace, name it AmazingApp and save it somewhere…


A strategy for coping with WWDC

Image for post
Image for post

Each year at WWDC, Apple unveil new features and APIs for their growing roster of platforms.

Some years are more exciting than others, but since this year is especially exciting and subjectively packed full of new stuff, I’d like to offer a plan for dealing with the overwhelming wealth of new information, not to mention chronic FOMO, and the feeling like you’re immediately lagging behind everyone so vocal on Twitter.

Unsurprisingly, the key is to be methodical and organised.

The Keynote

The public WWDC Keynote is fun to watch, but you don’t need to have FOMO if you don’t watch it live, or even watch it at all. …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store