This post discusses changes to SwiftUI first revealed at WWDC 2021 and are still in beta, so are subject to change.

If you’ve spent any time working with modal views in SwiftUI, you’ll usually want to have some way of dismissing them in code. As I discussed in my last post, there are a couple of ways to do this:

  1. Pass a binding to the boolean used in the isPresented: clause of the presenting modifier, and manually set it to false.
  2. Access the presentation mode environment object, and call dismiss() on its wrapped value.

The second option is the most…


Creating a dummy view that prevents users from accessing your app until they log in is quick and easy using ‘full screen cover’ modal views.

This article is geared towards SwiftUI on iOS/iPadOS 14, and example code is written using Xcode 12.5. The code in this article is now available on GitHub.

If you’re ever building an iOS app to complement an existing web service or for corporate use, you may have an app that is expected to have no functionality at all until the user logs in.

Any views that require some form of action before you can interact with the rest of the app are referred to as modal.

Modals in SwiftUI

One of the most common modal patterns in SwiftUI is the concept of a…


Building custom controls in a declarative style is easy with SwiftUI — and you can do it all on an iPad if you like

Apple’s declarative visual design framework SwiftUI, introduced in 2019, ushered in a very different way of thinking for those of us used to building user interfaces in Xcode’s Interface Builder.

While those differences can take a while to get used to, experience in building web components with a framework like ReactJS can be hugely beneficial to understanding how SwiftUI components composite together to create larger views.

For a project I’m currently working on, I wanted a view that showed how far along in a series of steps a particular project has got. Each project progresses through a fixed number of…


It is nine years since the passing of Elisabeth Sladen, an actor who was beloved to many as Sarah Jane Smith, the quintessential Doctor Who companion.

Elisabeth Sladen as Sarah Jane Smith, posing with K9 in front of the TARDIS.
Elisabeth Sladen as Sarah Jane Smith, posing with K9 in front of the TARDIS.

Upon hearing the news, I wrote this piece for The Stage’s TV Today blog. That blog and its contents have long since faded into the past — but to mark the anniversary of her death in 2011, it is reproduced here.

The news, when it came last night, was devastating. Elisabeth Sladen, who played Sarah Jane Smith in Doctor Who and associated spin-offs from 1973, has passed away after a battle with cancer. She was 63.

When I first came to Doctor Who in the very early 1970s, Sarah was already part of the warp and weft of the series. Through her, I came to see the role of the companion as something that is taken for granted today: independently minded, funny, and for whom terror was a trigger for thought and action instead of just screaming.

Sladen’s performance did more…


Applying your style guide selectively is the way to stay sane, but takes a little work

TL;DR Relax about the state of your old code (for now); work out how to make your new code (including changes) conform to your style first.

In my previous blog post in this series, I took a look at setting up RuboCop for use in a long-term legacy Rails project, including how to best utilise the ability to autogenerate a TODO file.

In short, contrary to what the --auto-gen-config option does for us, we shouldn’t inherit from the generated .rubocop_todo.yml file. That leaves our main configuration file, .rubocop.yml a lot cleaner. To repeat from that last post:

.rubocop.yml is a…


Ruby and Rails developers: adding style linters to your legacy projects is harder than it should be. Let’s do something about that.

This is the first of a series of posts I’m writing about implementing RuboCop in legacy Ruby and Rails projects, and which I am building into a wider talk to be given at a later date.

I’ve talked before about how having a consistent style guide is essential for any team of developers, and how one can set up RuboCop to apply that style guide across multiple projects managed by the same team.

But what if you have a project which has been worked on for a number of years without any style guide at all? In a typical Rails…


On a recent project, we hit an awkward snag: a set of tests, which ran perfectly fine locally in our Rails application’s RSpec suite, but would mostly fail when they ran on our continuous integration server.

What would be most annoying is that this was a fairly small ticket which was having all the problems. Without going into project specifics, the work involved:

  • Adding a new attribute to an existing Rails database-backed model
  • Adding that attribute to a couple of admin forms
  • Ensuring that the attribute’s value displayed directly in user-facing views, including email attachments

The relevant changes were driven…


Ruby on Rails (strictly speaking, the ActiveSupport gem which is installed as a prerequisite for all Rails projects, but which can be installed and used independently of Rails) has some pretty useful features built in.

One such feature is something that this week helped me rip out some tortuous code that was introducing a subtle HTML rendering bug. It’s something that only surfaced when we sent affected emails to specific mail clients, but it’s always nice to stop bugs occurring, however few people may have been affected.

The scenario

Each of our events can have many sponsors. There are multiple levels of…


I am ten years old. For as long as I can remember, I’ve been a Doctor Who fan. I’m not old enough to remember any other actor playing the Doctor, although I’m aware that he regenerates. But I’ve been an ardent fan of the older man — older even than my uncle John, the oldest man I know who isn’t of my grandparents’ generation — who to me epitomises everything that the Doctor stands for.

And all that has changed. Those greying locks, the patrician older gentleman, is being replaced by someone completely different, someone young and blond. I know…


Here we are again, with ten talking points about this week’s episode of Doctor Who: Smile by Frank Cottrell Boyce.

For newcomers, last week’s 10 Things About Who: The Pilot explains what little rationale there is behind each post. And if you haven’t yet seen this week’s TV episode, don’t come running to me if you find some of the stuff below to contain spoilers…

1. Happiness Patrol

“I’m glad.”

“And I’m happy you’re glad.”

The concept of a world that is fuelled by enforced happiness is one that is not unknown to Doctor Who. 1988 story The Happiness Patrol.

Graeme Curry’s story…

Scott Matthewman

Scott is a software developer during the day and a theatre critic & director of an evening. Which is the worst superhero identity ever.

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