Category Archives: iPad

WWDC 2021: Day 2 Thoughts

I watched a few sessions, mostly the overview ones.

watchOS

I’m even more excited by the always-on screen for apps. Workout apps, like Sprint-o-Mat, will be able to update the screen every second while running a workout session. This is good enough for me. They also let you know (via a SwiftUI modifier) that the screen is in the dimmed state, so you can reduce detail and focus on the most important parts of your interface.

There is also a Canvas in SwiftUI for watchOS now. Right now, the main view for Sprint-o-Mat uses stretched Circles to draw the progress rings. I did this because SwiftUI does not support elliptical arcs. I will have to check to see if Canvas is more powerful.

I also missed that unit tests work for watchOS targets in the latest Xcode. I currently keep testable code in a swift package so I can test it.

Swift

I hope that the improved type inference speed really works. I run into problems with this for even fairly simple code (where Swift just gives up and you need to rewrite it to be more explicit).

I also was unaware of Swift Numerics, which is nice. What I really want is something like a DataFrame, like Pandas, but this is a foundational step. I still use python as my “go to” for when I need something one step past a spreadsheet, even if I don’t need these features because I know they will be there if I need them.

One small thing that makes my life easier is that CGFloat and Double will automatically convert without an explicit cast. I write a lot of SpriteKit tutorials on App-o-Mat, and I like to keep the code super-simple.

And of course, async/await, will make lots of code better. I use it all of the time in Typescript, and I am looking forward to adopting it. Sprint-o-Mat is extremely asynchronous and I mostly solve its complexity with Combine today.

Speaking of Combine, I was somewhat surprised to see no mention at all so far, so I don’t think we’ll see more adoption in the frameworks this year.

WWDC 2021: Day 1 Thoughts

So far I’ve watched the Keynote and the Platforms State of the Union.

watchOS

The biggest thing to me was that a wishlist item I had this year and last year was finally done: watchOS apps will keep the screen on, not just show a blurred view with the current time. I had only asked for this for workout apps while doing a workout, but they are just doing it always, which is great.

They reworked the Breathe app, so I hope that they allow meditations more than 5 minutes. Also, I kind of want Tai Chi to log mindfulness minutes instead of workout minutes.

Swift Concurrency

Swift first class concurrency support is obviously great, but since Swift is open-source, we’ve known about this coming for quite a while. They seemed to have implemented it much like it’s implemented in other languages. I’ve been doing a lot of Typescript this year, and it seems basically the same.

They have also done a few important things related to this.

  1. If your asynchronous function returns a Result with a non-Never error type, they will automatically turn that into an exception.
  2. They provided async compatible versions of asynchronous APIs throughout their frameworks.

Focus

I am very much looking forward to the various Focus modes. I’m not sure that the new APIs will result in anything I want, but I am interested in innovation here.

Xcode Cloud

Xcode cloud isn’t going to be out for a while, but I signed up for the beta. My personal usage will depend on cost. I am using GitHub workflows for a new open-source swift framework I am building. In the past, I have used Microsoft’s App Center. Apple’s ability to provide cloud services to developers is mixed.

Things that are part of the app runtime, like notifications and CloudKit are excellent. They are reliable and fast. But, AppStoreConnect, the dev portal, and things like that are a mess.

If Xcode Cloud is considered mission critical and treated like notification delivery, then it will be great. But, I do suspect it’s more likely to be like AppStoreConnect (and I’m just talking about speed and reliability here — not the other pain points).

Face Time Data Channel

As part of the new Face Time improvements, they added an API to sharing data in a group to be used however the app wants. The demo was a shared whiteboard. I think this will be interesting beyond the obvious applications for streaming apps and games.

Random Stuff

There were a bunch of other random things that seem interesting.

  1. iCloud+ seems to come with a VPN now
  2. All the RealityKit stuff seems great — especially the object capture
  3. Playgrounds being able to make and deploy apps is great, but I don’t think this is for professionals.
  4. Multitasking menu on iPad will finally make this usable. This is the only thing that makes me want to update my OS immediately.
  5. Hoping on-device Siri works well, but my problems are with Siri just never responds sometimes (mostly music requests while out for a run).

New Article in the Swift Companion: Methods

Yesterday, I wrote that books should get you to write code, not just read it. I’ve been working on a companion to Apple’s Swift Programming Language book that helps you do that by offering exercises for each chapter.

I just published the companion to the Methods chapter on App-o-Mat. If you want to start from the beginning, go to the outline of Section 1. If you understand the content of the corresponding chapter, the exercises are meant to be very easy. If you are having trouble with them, it would be a good idea to review the chapter again before moving on.

WWDC 2020 Wishlist – Xcode / Swift

Yesterday I posted my watchOS WWDC wishlist, which is driven by what I am seeing in building Sprint-o-Mat.

I recently started working with Typescript and VSCode on an open-source project that needs a Swift and TypeScript version of the same functionality. I wrote a Swift version, and then did a very faithful (almost line-by-line) port to Typescript, which I did not know at all before starting. I never used VSCode (or Atom) before starting.

Microsoft makes excellent developer tools.

My project is admittedly very small, but luckily I can see how it works with with a large project because a minimal React site with Typescript has 48k files of dependencies. VSCode has nearly instantaneous code-completion and real-time error reporting. A minimal app in Xcode isn’t nearly as fast or reliable.

The combination of VSCode and Typescript makes Xcode and Swift look a decade behind. It’s comparable to Apple’s lead in chip design and the advantage that gives to its products — that’s the kind of lead Microsoft has in developer tools. Luckily for Apple, that advantage mainly flows to in-browser and server-side development, where Swift has effectively no usage.

Xcode / Swift Wishlist

  1. Make Xcode reliable and fast
  2. Make Swift compilation reliable and fast
  3. Make Swift type inference flow knowledge about values into conditionals. Here’s a simple example:

    let x = (anOptional != nil) ? funcExpectingNonNil(anOptional) : fallback

    We (and Typescript) know that anOptional is not nil in the call to funcExpectingNonNil, but Swift does not.

WWDC 2020 Wishlist – watchOS

Like previous years, my wishlist is highly influenced by what I’m working on and is not a prediction — just stuff I have needed in the past year.

I Just released a new watchOS app, Sprint-o-Mat that helps me in outdoor running workouts. I had actually started it before WWDC 2019, but completely started over to do it as an independent watch app on SwiftUI.

Here’s what I’d like from watchOS

Allow the user to control location privacy in the watch’s settings app
You can already control HealthKit authorizations on the watch, but changing location authorization makes you use the iPhone. This is impossible to link to, and very hard to explain.

Make some SwiftUI equivalent to WKInterfaceTimer
This view is what makes showing a timer easy and performant. You can update it with elapsed time at a low frequency, but it updates its view in between so that it looks like a running timer.

Unfortunately, you can’t even host WKInterfaceTimer in a SwiftUI View (via interop) because it doesn’t have a default init (and can only be constructed via a Storyboard)

Allow workout apps to keep showing on the display when a workout is running
When you run the built-in Workouts app, the display stays on and shows the UI of the app. For 3rd party workout apps, when you lower your wrist, the display shows the time and a frozen UI under a blurred overlay.

This means that 3rd party workout apps require the pre-always-on wrist movements if you want to see their updated UI.

Add the APIs that the Workouts app uses to send data to the Activity app
The built-in Workouts app appears to have private APIs (or private metadata) that the Activity app uses to enhance the workout display (e.g. custom icons, per-segment data). I’d like to see those, and even new ones, publicly available to any workout app.

Make some canonical way to base font-sizes on display size
There isn’t a good way that I can see to make a single View for 38mm and 44mm watches that look good without hardcoding or hacks.

There are a lot of other issues that I ran into, but the general idea of an independent watch app coupled with SwiftUI and the simplified app architecture more than makes up for it. If Apple just keeps moving this forward in big steps, I’ll be pretty happy.

WWDC 2019 Wishlist Results

Parameters in SiriKit custom intents & Fine-grained Shortcut integration (apps provide blocks): Parameters are definitely in and I believe (from the SOTU demos) that the Shortcuts app can directly call into intents with parameters, thus enabling more fine-grained interactions. This is great news, and even if you don’t think Siri as a voice-assistant would be useful for your app, you should want this for Shortcuts integration.

On-device transfer learning in CoreML: This is also in and unlocks all kind of on-device ML applications. There is also a new category of “easy” ML integration (voice/sound analysis) along with a ton of other improvements. CreateML is now a Mac app instead of being integrated into Playgrounds.

HKLiveWorkoutBuilder (from watchOS) in iOS: I don’t see any mention of HealthKit or workouts at all in the release notes, so no luck here.

Web->AppStore->App ad attribution (w/o user tracking): Even though this was not announced, I have some hope that this could happen. The WebKit announcement of an privacy preserving ad click tracking mechanism is evidence that this problem is on their radar.

The App Store story is even worse, because there is no official way to pass some kind of data through your App Store URL that the App gets on first start. The normal attribution mechanism, IDFA, is not available to websites (only apps), so the only way to do a website-ad -> AppStore -> App attribution is for the web site and App to “fingerprint” the user somehow. One simple way is a correlation with time and an IP address, but that isn’t perfect. Unfortunately, many apps (and 3rd party ad trackers) do not stop there.

The last few years have been a cat-and-mouse game between Ad Tech firms finding loopholes in iOS (e.g. shared Pasteboards) and Apple closing them. It would be much better if Apple provided a privacy preserving mechanism and then explicitly forbade anything else in the developer agreement.

Multi-select image picker: No luck this year.

WWDC 2019 Wishlist

Today I tweeted

Here’s a quick elaboration

Parameters in SiriKit custom intents: The custom intents that were introduced last year do not support recognition-time parameters. All of the parameters of the intent must be baked into the intent. SiriKit calls this “resolving parameters” and the built-in intents all support this, but custom ones do not.

On-device transfer learning in CoreML: Transfer learning allows you to build a new model from an existing one by providing more examples. CoreML added that last year, but you still need to train and build the new model off-device. I’d like a way to build new models this way on-device from device gathered examples (which would preserve privacy).

HKLiveWorkoutBuilder (from watchOS) in iOS: This class is only available for watch workout apps, but a simpler version would be nice for iOS workout apps. It obviously can’t gather heart rate, but it could automatically build the route and perhaps use a less sophisticated algorithm for guessing calories burned.

Web->AppStore->App ad attribution (w/o user tracking): The WebKit team just announced a privacy preserving ad attribution system for websites. I want the same thing to work for an ad for an app that appears on the web, App Store, or in another App. No need to attribute to a user — just the ad source is sufficient.

Fine-grained Shortcut integration (apps provide blocks): The Workflow team integrated the x-callback-urls of a bunch of popular apps into blocks — and Shortcuts still has them, but as far as I know, there’s no API for apps to provide small bits of functionality for Shortcuts to use as a building block. Even with the ones they have, the app comes up, does a bunch of stuff and then returns. A more streamlined experience would be nice.

Multi-select image picker: The current UIImagePickerViewController doesn’t support multi-select of photos. If you want to do this, you can build your own VC, but then you need to ask the user permission to their entire photo library in order to show them the photos. Since iOS 11, you have been able to bring up a picker without permission since it runs out-of-process and doesn’t give your app any access to the photos–just the one the user picked.

SwiftFest

I will be speaking about my experience with RxSwift at SwiftFest 2019 in Boston on July 29-30. Last year, I spoke there about how to sketch iOS UIs in Playgrounds — unfortunately the talks are not available online, but I’ll be putting together a video shortly that covers the material I spoke about.

I highly recommend this conference — it’s two-track and has about 300 attendees. I went to talks every chance I got and learned a ton. It will also be a good time to discuss the ramifications of WWDC as we’ll all have add a couple of months to absorb iOS 13.

If you are going to be there, contact me here or on twitter.

App-o-Mat updates

I started App-o-Mat as an iOS tutorial site back when I was consulting. It mostly had cordova screencasts.  I’m going to be doing more writing about iOS there (native and possibly cordova-based).

You can subscribe to the mailing list there if you want to get updates. If you have requests for topics to write about, let me know.

Here are the latest posts:

How do I pass values from a VC back to the VC that presented it?

Ok, so you have a view controller that brings up another view controller. Let’s call the first one FirstVC and the second one SecondVC. FirstVC either presents SecondVC or there is some segue that it uses to bring it up.

How do you keep Storyboards from causing merge problems later?

There’s this myth in the iOS community that “professional” iOS developers never use Interface Builder. It’s meant to imply that coding your interfaces is always better, and if you don’t do it, you are somehow less of a programmer. The myth perpetuates the idea that IB is a crutch, a toy, something that only newbies use.

I call BS.

How do you pass values to a VC in a segue?

A theme I see a lot on StackOverflow is a developer makes a View Controller that collects some information from a user and wants to use it on a VC that they bring up in a segue.