Autoscaling PDF Images On Apple watchOS

In this post, I will discuss autoscaling PDF images and how to add one to a watchOS project.

The PDF format allows an image to scale without looking fuzzy at different sizes. This format is best used with vector artwork; think icons. Programs like Inkscape, Adobe Illustrator and, Vectornator can export PDF images.

For more details on designing a PDF image see the Image Optimization page in the Human Interface Guidelines for watchOS. It includes the scales used for the different screen sizes.

Setting certain flags in XCode will tell WatchKit to scale the image based on screen size. And so, you have an autoscaling PDF image. This means the project only needs one image for all screen sizes. Otherwise, the project would need multiple scaled image files.


How I replaced a nested for loop with flatMap

This is a short post about how I refactored a nested for loop using flatMap. I had a struct that defined name and quantity properties as shown below:

struct Item {
  let name: String
  let quantity: Int

The actual code used a custom type rather than a String, but I’ve used String here to simplify the example.


SwiftUI: Previewing localized text in the canvas

Last week I watched the Swift packages: Resources and localization video from WWDC20. One thing I learned was that the Canvas can preview localized values. This is done by adding a locale to a View via the environment.


How I debugged a crashing watchOS app with crash reports and log files

In a previous blog post, I wrote about my app crashing when it was installed via TestFlight. In this blog post, I will go into more detail about how I debugged the problem using logs and crash reports.


Rejection, Acceptance, And Crashes. My TestFlight Journey

I hit a small milestone recently, I submitted my first app to TestFlight. I thought this process would be quick. Maybe a day or two. A week later I finally had a working app on TestFlight. During that time I learned much about crash logs and debugging. Here is my story.


Specify XCode version for GitHub workflows

I wrote a unit test that used the XCTUnwrap function. This feature was added in XCode 11 and

“Asserts that an expression is not nil and returns the unwrapped value.”

However, when I pushed my code to GitHub, the build broke with the following error.

error: use of unresolved identifier ‘XCTUnwrap’


iOS Constraint Issues

This post is about a problem I had with a UISearchController in an iOS app. The issue was the search bar would animate on top of the status bar. This made it hard to use as shown in the following video.


My iOS app journey

It’s been awhile since I blogged, so I thought I should provid an update.

In the autumn of 2018 I started developing as iOS app as a hobby. Previously, I worked through the “iOS Development with Swift” book. The book leads you through the process of building an app. By the end of the book you have created a multi-screen functional app which lets you enter and sort books. I enjoyed the process and wanted to build my own.


Problem Solving Checklist

I was recently working on a problem from a tutorial. The problem was basic: write some code that will build a Google search URL. It had the following requirements:

  • take a string to use for the search term
  • specify the google domain to search
  • use the ‘num’ parameter to limit the number of search results
  • use the ‘as_qdr’ parameter to limit the date range

The reason for implicitly unwrapped optionals

In a previous post, I wrote about implicitly unwrapped optionals. However, I was not happy with the example I created; it felt contrived. The following is the example I used: