Cloud Services / Development / Tools

WWDC21: iOS Platform Upgraded, but What About the Web?

21 Jun 2021 9:41am, by

‘Tis the season for developer conferences. I recently wrote about Google I/O and Microsoft Build, the developer-focused events from those two big tech companies. Now it’s time to explore this year’s Apple Worldwide Developers Conference (WWDC), held as a virtual event earlier this month. I was particularly interested in seeing what — if anything — Apple had to offer web developers.

Richard MacManus
Richard is senior editor at The New Stack and writes a weekly column about web and application development trends. Previously he founded ReadWriteWeb in 2003 and built it into one of the world’s most influential technology news and analysis sites.

One never knows what to expect in regards to web initiatives from Apple. While the company is a member of the WHATWG group that nowadays steers HTML and other web standards (the other founding members are Google, Mozilla and Microsoft), Apple is famously protective of what it allows on its devices in terms of web functionality. Google’s Chromium browser engine isn’t allowed on iOS, for instance — instead, it has to offer a version of Chrome based on Apple’s browser engine, WebKit. This has stifled some web innovation in recent years, notably with Progressive Web Apps (PWAs).

Predictably, much of the keynote presentation was devoted to the latest Apple gadgets and user features on iOS (such as a new “multitasking” feature on iPad). While it’s always important for developers to have advance notice — and early access — to new Apple features, it’s usually nothing for web developers to get excited about. But there was a section of the keynote towards the end that focused on Safari, Apple’s Mac-optimized web browser, which would’ve roused developers from their slumber.

“Our users are doing more in the browser than ever before — work, school, shopping and entertainment,” said Craig Federighi, Apple’s senior vice president of software engineering. This was a surprising thing to hear, since most of the rest of the keynote was devoted to iOS technologies. In any case, Federighi went on to announce that Apple had “reimagined the browsing experience” in Safari, with new ways to organize tabs, changes to how the toolbar works, and “instant syncing” between all of your Apple devices.

But again, these Safari announcements were for users — not developers. And not just any users either: “Mac users,” Federighi reminded us.

Safari Web Extensions for iOS

Then Federighi introduced what was perhaps of most interest to developers in this keynote: Safari web extensions for iOS. “We’re bringing web extensions to iPhone and iPad,” he said, adding that they “can share code with existing Safari web extensions.” A big part of the reason these extensions can share code is that they’re made with open web technologies — JavaScript, HTML and CSS.

So far, this sounds a lot like Google’s PWAs. But a key difference is that in terms of distribution (for the developer) and installation (for the user), a Safari web extension is a type of iOS app.

“It’s important to understand that for Safari, web extensions are parts of apps,” explained David Quesada, an engineer on the Safari team, in a separate WWDC presentation. “So when you want to install a web extension, you install its app. And like any other type of iOS app, apps with Safari Web Extensions can be found on the App Store.”

Apple’s David Quesada explaining the Safari Web Extension for iOS.

What this means is that the web extension is wrapped in a native macOS or iOS application, designed in Xcode (Apple’s integrated development environment). For the user, this means they install the app from the App Store — just as they do for normal iOS apps. Whereas for PWAs, users install them inside their browser. The latter approach means that developers can avoid the cost and headaches — such as going through the approval process — of dealing with an app store.

WebKit Updates

As for WebKit itself, the browser engine that drives Safari, there were plenty of updates announced throughout the WWDC — nicely summarized in this WebKit blog post. One WWDC session explored upgrades to WKWebView, described as “the view that is used to show all web content on iOS and much of macOS.” As explained by Megan Gardner, an engineer on Apple’s WebKit team, WKWebView is specifically designed for interactive web content (there’s a simpler mechanism available, SFSafariViewController, if the user doesn’t need to interact with the content).

The thing that stood out to me in this session was the use of APIs to manipulate web content, without having to use JavaScript. Wait, no JavaScript?! That sounds like sacrilege on today’s web.

“We love JavaScript,” insisted Gardner, before launching into an explanation of why Apple developers should avoid it for web views.

“It is the language of the web! But injecting JavaScript is complicated. The interface between native and web that you need to cross via injection can be difficult and cumbersome to navigate. It can also easily have unintended side effects or be difficult to manage when dealing with content from multiple web sources. It’s best to avoid that headache if you can.”

Developer headaches aside, the key issue here is that Apple purposefully limits the use of JavaScript in some of its products. Gardner noted that with Apple Pay, for example, there are some “high-value features” that you don’t have access to in your web view “if you choose to inject JavaScript.”

To route around JavaScript in such cases, Apple has introduced several new WKWebView APIs — for things like accessing theme colors for a website, disabling text interaction, and controlling media playback.

Apple’s Megan Gardner summarizing WKWebView updates.

I should note here that another WWDC session covered some of the JavaScript enhancements in WebKit and Safari, as well as how it’s adapted to newer open web technologies such as WebAssembly. So Apple does still love JavaScript.

Other WWDC Developer News

Back to the WWDC keynote now. In the ‘developer technologies’ section, Susan Prescott, vice president of worldwide developer relations at Apple, announced a raft of new APIs. These included a 3D-rendering API called Object Capture that “uses photogrammetry to turn a series of 2D images into photo-realistic 3D objects in just minutes,” which admittedly looked incredible.

Prescott also talked about improvements in Swift, an open source programming language that Apple developed and released in 2014. Updates included improved support for concurrency and asynchronous code. Prescott noted that “Object Capture and all the APIs we’ve talked about today are built on the Swift programming language.”

Also worth noting is a new developer product called Xcode Cloud, a continuous integration and delivery (CI/CD) service for Apple developers.

Conclusion: Nice Updates, but Nothing Groundbreaking

We expect every WWDC these days to focus primarily on new macOS and iOS features — and the 2021 virtual edition was no different. The web development announcements in this year’s WWDC were interesting, but not groundbreaking. Safari web extensions for iOS is a nice expansion, but they lack the true web portability of Google’s PWAs. There were also useful WebKit and Safari upgrades that will be appreciated by Apple developers (summarized in an Apple blog post entitled “The web developer’s toolkit”).

However, I didn’t see any announcements during the event of web platform enhancements — in other words, things that will benefit non-Apple platforms. At Google I/O, we got increased web integration with Operating Systems via new APIs like the File System Access API. At Microsoft Build, there was innovation in integrating the web with office software (with Fluid Framework and other “collaborative app” technologies). There was nothing of equivalent importance to web developers at WWDC21.

But who am I to complain? As long as Apple developers have iOS and an ability to integrate the web into its native apps when necessary (sans JavaScript headaches), then the Apple developer ecosystem will be happy.

Feature image via WWDC webcast (pictured: Craig Federighi).

A newsletter digest of the week’s most important stories & analyses.