The personal blog of Stuart Breckenridge

Lucky Dip with SwiftUI and Combine

My first iPhone app — in hindsight, my first UIKit app — was called Lucky Dip, and I released it about eight years ago. It was a little utilty that helped you pick lottery numbers for four different lottery games available in the UK.

Lucky Dip

With last week’s introduction of SwiftUI and Combine at WWDC, I though I’d build a new version of Lucky Dip to get some experience with these new technologies.

It turns out it didn’t take too long and it’s pretty much done.

Lucky Dip with SwiftUI

I’ll be putting the source code on GitHub soon.


WWDC 2019 Wish List

It’s very close to that time of the year when all our Swift code breaks we get lots of new API to play with. Below is my work in progress list of features I’d like to see.

MapKit

  • Dark mode for maps. If there is to be a dark mode for iOS system-wide, I’d like an API that allows me to give the user a controllable dark mode for UIMapView.
  • Access to transit overlays. At the moment transit overlays, e.g. bus routes or MRT lines, are not available via any public API.
  • Snap to roads. Give developers an option to snap an MKPolyline to a road.
  • Increased direction request limit. You can currently get directions for up to 50 waypoints before you are rate limited. When calculating bus routes there are usually more than 50 waypoints, so that means using a less accurate MKPolyline to represent the route. This could be negated by giving access to transit overlays.

Alternative Icons

  • Alternative icon management. Move alternative icons to the asset catalog and remove the need to configure via Info.plist.

GameKit

  • Refresh the whole thing. GameKit has been neglected for so long. The documentation hasn’t been updated in over three years and there aren’t, as far as I can tell, any Swift code samples. It’d make sense for Apple, given their new focus on games, to really revamp GameKit.

Xcode

  • Storyboard performance. Make this faster, please.
  • Customisations. Via Becky Hansmeyer:

    every visual customization that is possible for a UI component should be editable in Interface Builder

  • SourceKit. LSP
  • Navigation. Clearer UI for different targets within the Navigator area.

Font Management

  • Asset catalog. Put fonts in the asset catalog and remove the need to configure embedded fonts via Info.plist.

Analytics

  • Framework. A first-party, privacy focused analytics framework, to challenge Firebase and App Center.



MacBook Pro 2019

Chance Miller, 9to5Mac:

Apple has announced today that it is upgrading the MacBook Pro with faster 8th- and 9th-generation Intel Core processors. This revision marks the first time that the MacBook Pro has been available in an 8-core configuration. The new MacBook Pro models also feature a revised keyboard design.

[…]

In addition to the faster processors, Apple says the new MacBook Pros feature a new iteration of its Butterfly keyboard technology. Apple is including the new keyboard on the new 13-inch and 15-inch MacBook Pros released today. Apple didn’t offer any details on whether or not the new keyboard design would also make its way to other Butterfly keyboard Macs, such as the MacBook Air.

In addition, Apple is expanding its keyboard-replacement program. Joanna Stern, for the Wall Street Journal:

Apple on Tuesday said it was changing a material used in its butterfly keyboards and expanding its keyboard-repair program. The program previously covered first- and second-generation keyboards, but now includes coverage of the third-generation keyboards introduced last year on MacBook Air and high-end MacBook Pro models.

The fact that all butterfly keyboards, from first-gen through to today’s redesign, are covered by the replacement program is a good thing. However, it doesn’t fill me with confidence that Apple has got to the bottom of what’s making the keyboards so unreliable.


Becky Hansmeyer: WWDC 2019 Developer Wishlist and Keynote Predictions

Via Becky Hansmeyer’s WWDC 2019 Wishlist:

stop making us […] write dumb hacks like adding a blank UIImage as a navigation bar’s “shadow” just to get rid of that line beneath it

I used to do this for Singapore Transit and it was incredibly annoying. However, a simpler approach is available (though still not ideal):


navigationController?.navigationBar.setValue(true, forKey: "hidesShadow")

That said, I think UINavigationBar does need to have support added for multi-line title labels in both normal and large title mode.


Powerbeats Pro Not Available Until June in Singapore

Joe Rossignol, Macrumors:

While the black Powerbeats Pro remain listed as “coming soon” on Apple’s online store elsewhere, recently updated fine print on the Beats website indicates that the earphones will begin their worldwide rollout later in May and June.

Powerbeats Pro will be available to pre-order in black later in May in the United Kingdom, France, and Germany, followed by Australia, Singapore, China, Japan, Hong Kong, Korea, Austria, Italy, Spain, Ireland, The Netherlands, Belgium, Russia, Switzerland, Sweden, Mexico, and Brazil in June, according to the fine print.

Not great as I wanted to buy them before this year’s Sundown Marathon.1

  1. My left AirPod only lasts about 40 minutes on a full charge these days. That’s barely long enough to get through about a 7km run. ↩︎



The Boeing 737 Max has Crucial Safety Equipment Sold as an Optional Extra

Essential reading from Jon Ostrower, at The Air Current:

Lion Air 610 should never have been allowed to get airborne on October 29, a conclusion shared by those familiar with the inquiry. The plane simply wasn’t airworthy. According to the preliminary investigation, PK-LQP’s Angle of Attack sensors were disagreeing by 20-degrees as the aircraft taxied for takeoff. A warning light that would’ve alerted the crew to the disagreement wasn’t part of the added-cost optional package of equipment on Lion Air’s 737 Max aircraft.

It’s staggering to me that any safety feature is sold as an optional extra.


We Can't Blame the EU for This

Polly Toynbee, for The Guardian:

At least May spelled out one useful warning. When everything collapses around their ears, when Brexit proves a calamity, “It will be no good blaming the EU, responsibility would lie with this House.” And so it would – unless this House can pull back, revoke article 50 with a confirmatory public vote, and try to dismiss this whole desperate episode as a brief strange nightmare that history should forget.

The Leave Campaign also shoulders a degree of responsibility for lying.

Regardless, now that the public has an understanding of the costs and implications of leaving the bloc, a confirmatory vote is the only logical, fair way forward.


Thunderbolt 3 and USB to Converge Under USB 4.0

Joe Rossignol, via Macrumors:

USB4 converges the Thunderbolt and USB protocols as part of Intel’s goal to make Thunderbolt available on a royalty-free basis, which should result in wider and cheaper availability of Thunderbolt accessories like docks and eGPUs.

The USB4 specification is on track to be published around the middle of 2019. Over 50 companies are actively participating in the final stages of review of the draft specification, which should include Apple, Intel, and Microsoft, but it might take a few years until the first USB4 devices are released.

USB4 is Thunderbolt 3. As such, I don’t think it’ll take as long as a few years before we see USB4 devices.