Archive for October 1, 2021

Friday, October 1, 2021

Swift Declarative String Processing Pitch

Michael Ilseman (tweet):

String processing is hard and the current affordances provided by the Swift Standard Library are underpowered. We propose adding two new declarative string processing APIs—a familiar Regex literal and a more powerful Pattern result builder—to help make Swift string processing fast and easy.

[…]

We propose adding a new regular expression literal, with strongly typed captures, to Swift.

[…]

Sophisticated features like inline capture group processing feel right at home with the result builder syntax because it’s all just regular Swift code—it isn’t nearly as natural to try to force this kind of functionality into the regex literal.

[…]

We intended to extend and add generic consumer and searcher algorithms to the standard library for operating over collections using patterns or regexes.

[…]

The Swift operator ~= allows libraries to extend syntactic pattern matching by returning whether matching succeeded or not. An enhancement to this would allow libraries to produce a result as part of a destructuring pattern match, allowing patterns and regexes to be used inside case syntax and directly bind their captures to variables.

Michael Ilseman:

I’ve been finding it helpful to think of our long-term goal as making Swift awesome at string processing, data processing, and “event processing” (working title, suggestions welcome). These are not rigid or clear-cut distinct domains (they actually blend together in extremity) so much as they are 3 interesting “regions” in this design space. Thinking about these regions helps clarify what tasks we’re enabling and helps push us towards more general solutions.

Each of these regions share technical fundamentals, but present novel performance and API design challenges. I hope that keeping the big picture in mind will help guide the design process towards pragmatic trade-offs and robust solutions.

[…]

We want to be able to compose, layer, and even interweave different kinds of processing together. And, we want these areas to be library-extensible, so that libraries can provide custom behavior through custom protocol conformances.

Previously:

Update (2021-10-15): Hamish Knight:

We propose to introduce a first-class regular expression literal into the language that can take advantage of library support to offer extensible, powerful, and familiar textual pattern matching.

PSPDFKit Takes Venture Capital

PSPDFKit:

PSPDFKit, the leading document processing and manipulation platform for developers and enterprise businesses, today announced its first strategic growth investment led by Insight Partners, a New York-based global venture capital and private equity firm focused on growth-stage software and technology companies. Insight’s investment, which totals more than €100 million, is expected to accelerate product growth and fund strategic acquisitions, further expanding the capabilities of PSPDFKit’s highly adopted document processing platform.

Nearly a billion end-users in over 150 different countries rely on PSPDFKit every day while using web and mobile applications that are built on the company’s platform, including industry leaders like Dropbox, DocuSign, SAP, IBM, Volkswagen, Fabasoft, Wolters Kluwer Deutschland, and the European Patent Office.

Ingrid Lunden:

PSPDFkit is already profitable, and it has been for a while, so this investment is about stepping up its pace of growth. It plans to use the investment to build more developer tools, make strategic acquisitions (co-founder and CEO Jonathan Rhyne is mum about what, except to say that it will be to expand the suite of useful tools that it provides); and, for the first time, make some concerted efforts in the areas of sales and marketing.

Via Peter Steinberger:

After 10 years of building PSPDFKit, I am moving into an advisory role.

Previously:

iCloudCoreDataStarter and Temporary IDs Bug

Chad Etzel (tweet):

In the course of building Sticker Doodle (which you should go download right now), I ran into many brick walls and learned way too much about Core Data, iCloud sync, Collection and Table Views, and Diffable Data Sources.

There is documentation for each of those individually, but I could find no clear and simple example project that ties them all together in a neat little bow.

Well, that changes today.

[…]

Before .save() is called on the managed object context, this temporary ID can be used to fetch the object, refer to it, etc… it acts like a normal NSManagedObjectID -- HOWEVER, after .save() is called on the managed object context, 2 things are supposed to happen:

  1. NSManagedObjects with temporary IDs are supposed to be assigned a permanent ID and those objects updated in memory with the new ID.

  2. The managed object context forgets all temporary IDs and attempting to use them to identify an object will fail.

There seems to be a bug (in iOS 14 and iOS 15 as of my latest testing) where sometimes Step 1 will not actually happen and newly inserted and saved objects will still have a temporary ID!! This has led to all sorts of unexpected and frustrating behavior until I figured out what was actually going on. There are several developer forum posts and Stack Overflow questions regarding the same behavior, so I am not the only one that has experienced this bug.

Previously:

iOS 15 Messages Bug Deletes Saved Photos

Juli Clover:

If you save a photo from a Messages thread and then go on to delete that thread, the next time an iCloud Backup is performed, the photo will disappear.

Even though the image is saved to your personal iCloud Photo Library, it appears to still be linked to the Messages app in iOS 15, and saving it does not persist through the deletion of the thread and an iCloud backup.

Aside from the data loss, this bug is concerning because I thought that the Messages, iCloud Photo Library, and iCloud Backup systems would be isolated from one another. iMessage threads are supposed to be end-to-end encrypted in iCloud, and they aren’t backed up if you have syncing enabled. Photos and iCloud Backup are not end-to-end encrypted. And photos in iCloud Photo Library don’t go into the iCloud Backup, anyway.

Secondly, is there something a third-party app could do using the PhotoKit API that would also trigger the bug? Or is it related to private APIs that Messages is using?

iOS 15 Shortcuts and SwiftUI

Federico Viticci:

Unfortunately, the Shortcuts experience in iOS and iPadOS 15 is hindered by a variety of severe UI and performance bugs that have made this update the least stable and reliable one in recent memory. I believe Apple is aware of these bugs and is actively working on fixing them, but that doesn’t change the core problem: the Shortcuts app shipping with iOS and iPadOS 15.0 is buggy, crashes often, and gets in the way of power users with SwiftUI-related issues that prevent interactions with the editor.

I don’t want this section to read like a feedback report, so I’ll keep it short, but I also think it’s important to point out that the Shortcuts team should have done a better job with app performance and stability this year. For instance, due to a widely reported SwiftUI bug, it’s often impossible to click UI elements in the editor unless you close and reopen it. This bug is so bad, it has made it extremely challenging for me to work on long shortcuts this summer since I’d have to close and reopen the editor (thus losing my position in it) every 30 seconds. I’m astounded this bug shipped to customers.

Alas, there’s a lot more. Sometimes, drag and drop for actions just refuses to work or drops an action in an entirely different spot in the editor. The ‘Run Shortcut’ action – a fantastic tool for power users that lets you use shortcuts as functions – is somewhat broken at the moment and doesn’t always recognize input. The magic variable output of Choose from Menu blocks no longer works. Sometimes, the share sheet sees no input passed from other apps. When I run shortcuts that contain Files actions with the editor open on my iPad, the app crashes.

Nick Heer:

As my professional and personal technology experiences increasingly revolve around the software-as-a-service model, I have recently been thinking a lot about the lack of stability as a priority. We are on the receiving end of a firehose of changes, redesigns, new features, and reimplementations of existing products. Yet the threshold for problems that will prevent a product from being shipped seems to be getting stricter.

What Viticci describes is an application that Apple shipped — in a production release of its most popular operating system — in an entirely unusable state. It is not a solitary case, nor is Apple the only software vendor to rush something out the door. But stuff like these Shortcuts problems — some of which are UIKit problems — and Siri regressions are profoundly disruptive to frequent users.

Steve Troughton-Smith:

A painful reckoning for Shortcuts & SwiftUI. I don’t think Shortcuts can afford to rewrite its UI every year anymore, it’s too critical a tool for its users and the consequences of it going wrong (like it has, this year) are devastating. SwiftUI was a misguided leap of faith

The newly-rewritten multiplatform Shortcuts app was always going to go one of two ways: a poster child for SwiftUI, or a cautionary tale. I’m really curious what, if anything, broader-Apple will learn from the experience — how it’s developing SwiftUI, and how it’s positioning it

Thomas Clement:

SwiftUI still has a long way to go, especially on macOS.

Certain basic things are still broken or simply impossible to do. The bridging with AppKit can be impossible to work with so there’s just no good solution sometimes.

Steve Troughton-Smith:

We’re in ‘year 3’ of SwiftUI, and my base advice remains unchanged — it is great for auxiliary non-critical UI layouts (inspector sidebars, settings windows, and panels), watchOS apps, and rapid prototyping. Beyond that, it just does not meet the bar for complex, reliable apps

[…]

There’s a clear analogy, and lesson to be learned, between ‘SwiftUI is the future’, and ‘iPad is the future of computing’

Previously:

Update (2021-10-04): Federico Viticci:

Imagine if you couldn’t trust that the Notes app for iPhone and iPad actually saves your text. Or that you fear Mail may send truncated emails to people.

That’s how bad Shortcuts is right now / has been since June. It’s painful to watch and I have no idea what’s going on there.

Previously:

Update (2021-10-19): Steve Troughton-Smith:

In 2015, you could build pretty much everything you needed to build in an iOS app with Swift. It was very much a peer to ObjC, even if very unfinished, and there was a clear path from one to the other. It could back deploy to iOS 7, and even iOS 6 (unofficially)

SwiftUI is not that. It is not a full-featured replacement for existing UI frameworks, has no back-deployment strategy, and has all manner of issues that can make your app buggier & less consistent if not properly handled as Apple’s own apps have demonstrated to disastrous effect

It is not clear at all that someday SwiftUI will power everything you see on iOS, without some bigger, better, more powerful UI framework underneath. That’s certainly the dream for a lot of folks, but I honestly don’t know if iOS is the platform that will ever get to that point

Federico Viticci:

I’m afraid we’re in for a long season of Shortcuts bugs due to their SwiftUI rewrite in iOS 15. If these can get fixed before 16.

iOS 15.1 beta 3, still can’t reliably drag and drop an action.

Drag and drop…for an app based on dragging and dropping things around.