The Shifting Sands of Marzipan
The most recent news of Apple’s cross-platform efforts come from testy pundit John Gruber, who asserts the following:…basically it sounds like a declarative control API. The general idea is that rather than writing classic procedural code to, say, make a button, then configure the button, then position the button inside a view, you instead declare the button and its attributes using some other form. HTML is probably the most easily understood example. In HTML you don’t procedurally create elements like paragraphs, images, and tables — you declare them with tags and attributes in markup.Gruber goes on to note, “There’s nothing inherently cross-platform about a declarative control API,” adding it makes sense that there would be such tooling if apps were to work for AppKit and UIKit. Mark Gurman of Bloomberg, who originally broke the news of ‘Marzipan,’ isn’t ready to admit Gruber’s info tells the whole story:
Essentially, Gruber seems to be saying ‘Marzipan’ is really an API to make iOS and macOS apps work better together, while Gurman says the API is one aspect of a larger project.Sounds like that‘s referring to a pair of separate projects (known alternately as “Amber,” “Infrared” and “Ultraviolet”) from the Swift team. Not the same as the iOS apps on Macs initiative. There are many moving pieces with a major multi-year, multi-step project like this. https://t.co/jXKa5vRTzi
— Mark Gurman (@markgurman) May 1, 2018
Marzipan, React, and Swift
Let’s start with Gurman’s follow-up tweet to the one above:It’s something Gruber hints at in his post, writing: "There’s an industry-wide trend toward declaration, perhaps best exemplified by React, that could be influencing Apple in this direction.” I’ve long posited Apple may be waging a shadow-war on React, as much of its recent efforts to cull ‘bad’ apps from the iOS App Store affect apps using the React Native framework. To wit, the main offense is that those apps use widely duplicated external frameworks and are not quality submissions. But Gruber’s point that React is a great example of declaration rings true. And perhaps Apple’s apparent rankle with React is that it doesn’t play entirely within Apple’s walled garden. So, we may get Marzipan or some sort of API to mimic what React does so well; it’s not ‘sherlocking’ so much as it is creating a better environment for Apple’s loyal user-base. Declarative APIs aren’t new. Gurman’s point about XAML is well received, and Windows makes use of declaration in theThis initiative likely intends to replace NIB files with Swift, linked to Interface Builder, which could allow developers to declare their UIs by hand or by using the existing visual tools, much like XAML on Windows.
— Mark Gurman (@markgurman) May 1, 2018
AdaptiveTrigger
class, which allows unique rendering depending on screen size and orientation. The main idea of declarative APIs is to separate app logic from views. If we’re getting cross-platform apps, this makes sense. More to the point, it makes good sense for the Fall, when Swift gains ABI stability. Even more central is that Swift is quickly becoming a language useful for server-side use-cases, such as databases – where an app’s logic is usually held.