Archive for May 12, 2021

Wednesday, May 12, 2021

Fixing Swift’s “if let” Syntax

Craig Hockenberry (tweet):

The if-let syntax discourages long variable names because there’s no autocomplete for optional variables that are in scope. It’s not uncommon to see things like this because programmers are notoriously lazy:

if let favc = fooAutomationViewController { … }

Any code within that block that references favc won’t be very readable.

This maintenance issue is exacerbated by name refactoring. Say you want to change fooAutomationViewController to a barAutomatedViewController. The refactored code will then become:

if let favc = barAutomatedViewController { … }

The if let fooAutomationViewController = fooAutomationViewController repetition is one of the more annoying things about writing and reading Swift. Allowing this to be written as just if let fooAutomationViewController seems like the obvious solution. For those arguing that this is confusing or hard to learn, I don’t see how it’s any less clear than what it would be replacing. That said, I wouldn’t be opposed to something like unwrap.

Update (2021-06-18): Marcel Weiher:

When I added ifNotNil: some time ago, I used the same logic, but it turns out the object is now actually potentially interesting. So ifNotNil: now passes the now-known-to-be-non-nil value to the block and can be used as follows[…]

[…]

This doesn’t eliminate the duplication, but does avoid the issue of having the newly introduced variable name precede the original variable. Well, that and the whole weird if let in the first place.

You can do this in Swift by calling map(_:) on the optional. It’s useful in some cases, but, since it relies on a closure like forEach(_:), it’s often not a good fit because it doesn’t compose well with other language features (additional optionals to be unwrapped, continue, return, etc.).

Sketch Subscriptions

Sketch:

Over the past few years, we’ve evolved Sketch to be more than the Mac app. It’s now a fully integrated platform for design and collaboration, combining the best native Mac editor with tools that work in any web browser. Today we want to share a few highlights, what’s available in Sketch right now, and what you can expect from us in the months ahead.

Sketch (Hacker News):

The complete Sketch experience — including real-time collaboration in the Mac app, feedback and handoff in the web app, and a shared Workspace to bring all your people and documents together — is now a subscription. Learn more about subscriptions.

As a result of the changes, licenses are becoming Mac-only licenses. With a Mac-only license you’ll get access to the Mac app only, so you can work on local documents. Licenses do not include the option to save or open files from the web app, or any collaboration features (including real-time collaboration).

Officially, nothing is changing for those of us just using Sketch as a traditional Mac app. But, as with TextExpander and 1Password, it’s not a good feeling when the developer declares a use case that you’re not interested in to be the future of the app. Note that I’m not saying that these were bad business decisions.

Previously:

Update (2021-05-24): Vítor Galvão:

I keep a list of “perpetual fallback licensing” software, and Sketch was a big part of why I started.

It saddens me that I’ll have to remove it from that list. It used to be the first example I mentioned.

Diet Coda Discontinued

Michael Buckley (Hacker News):

Unfortunately, like Transmit iOS and Status Board before it, we’re discontinuing Code Editor as it doesn’t generate enough revenue to cover its continued development.

[…]

The churn of new web tools and tech is rapid and constant. This is why having a flexible extension system is essential for a modern web-focused IDE. But that’s where the trouble lies.

The biggest technical hurdle is the inability to run external processes on iOS and iPadOS. There’s just no way around it: this is required for modern web development.

[…]

Even if it were viable, we’d likely run afoul of App Store policy as well. Apps on iOS and iPadOS must use Apple’s Javascript interpreter, JavaScriptCore. Although JavaScriptCore is excellent, many developer tools rely on features or behaviors only present in Google’s V8 JavaScript interpreter. Similarly, WebKit is the only allowed web rendering engine on iOS.

And still, even if we could find some clever technical way around all of these limitations, we wouldn’t know if our approaches would be allowed on the App Store until we’d fully built and submitted them for review. So, we’d be facing a huge investment of time with the possibility that it would all ultimately get rejected.

Nick Heer:

Panic has tried to crack this nut multiple times without success, but it is hard to see how any developer can make iOS work for apps like these. We all know that Panic makes great software, it has enthusiastic users, and it has long been a high-profile independent developer. Even if iOS is out of the question, evidence is mounting that Apple is kneecapping iPadOS by continuing to treat it with the same kinds of developer and app distribution rules as a smartphone.

Mike Rockwell:

I probably sound like a broken record at this point, but this is yet another example of why Apple needs to open up the platform. Not just so developers can explore other options for monetization, but to loosen up the arbitrary restrictions on what is even possible on the platform. How many apps like Code Editor do we have to lose before Apple wakes up?

Previously:

Epic v. Apple, Day 7

Adi Robertson (tweet):

And while Epic itself has focused on explaining why web apps aren’t a good substitute for native ones, its expert witness David Evans brought up another major issue: anti-steering rules.

Anti-steering rules (in this context) refer to rules that ban developers from pointing users outside of Apple’s ecosystem. iOS developers can’t add links or references telling people to get a better deal on their website, or send emails to accounts created through Apple.

[…]

Evans basically responded that in this analogy, cab drivers can’t even do the equivalent of giving passengers their phone numbers. […] The problem, he said, was the combination of requiring Epic to use Apple payment processing, plus a “whole set of barriers” that make it harder to tell users they have an alternative.

[…]

Evans admitted that nixing the anti-steering provisions “wouldn’t eliminate the market power that Apple has here, but it would certainly diminish it.”

[…]

Later in the day, economist Susan Athey raised a different issue with App Store exclusivity. The App Store lets users sign up for subscriptions, but if they switch to an Android phone, they have to either cancel their subscription or keep managing it through Apple. Athey was using this to explain why a third-party app store would be useful, should Apple ever allow one to exist — if you could access the same purchase from both big phone platforms, the same way you can get your old iOS apps on a new iPhone, switching devices could become much easier.

Apple:

Threats have been present since the first day the App Store launched on iPhone, and they’ve increased in both scale and sophistication in the years since. Apple has likewise scaled its efforts to meet those threats, taking relentless steps forward to combat these risks to users and developers alike.

[…]

In 2020 alone, Apple’s combination of sophisticated technology and human expertise protected customers from more than $1.5 billion in potentially fraudulent transactions, preventing the attempted theft of their money, information, and time — and kept nearly a million risky and vulnerable new apps out of their hands.

[…]

If a developer violation is egregious or repeated, the offender is expelled from the Apple Developer Program and their account terminated. Apple terminated 470,000 developer accounts in 2020 and rejected an additional 205,000 developer enrollments over fraud concerns, preventing these bad actors from ever submitting an app to the store.

John Gruber:

What Apple is trying to say is that this is a five nines sort of problem — that they could (and do) stop 99.999 percent of scams but the App Store is such a juicy target for crooks that hundreds of scams still slip though.

Why not 99.99999 percent efficiency though? Apple is the richest company in the world. If they want to run the App Store with whatever-they-say-goes authority, why should we, as customers, demand anything less than perfection on the fraud and scam front? True perfection they’re never going to achieve, but it sure seems like Apple could be doing better than they are. And they know it.

Nick Heer:

The half-a-million developer accounts terminated in 2020 compares to only about 180,000 new developers Apple says that it worked with to get their apps into the App Store.

[…]

Unfortunately, none of the numbers in this press release have any attached context. For example, Apple says that it rejected over 215,000 apps in 2020 for not meeting its privacy standards. But to understand what that means in terms of the total number of submissions, you have to go find the documents that surfaced in the company’s lawsuit with Epic Games, where you will find an average of about five million apps submitted annually, around 35% of which are rejected for any reason. But we still don’t know anything about the kinds of apps that were rejected. How many of the 215,000 apps were ever admitted into the store? And were any of them downloaded by users before being pulled? The answers to these kinds of questions are not in this press release.

[…]

These are the only options available to report a fraudulent app? These? I have already covered how Report a Problem is insufficient for raising alarms about a rule-breaking app, particularly if it is free. And the only other thing I can do, as a customer, is to telephone Apple Support? Ridiculous.

Previously:

Update (2021-05-18): Ben Brody:

David Evans explained in court on Monday and Tuesday that although Apple has competition when it comes to actually making smartphones, it monopolizes what he described as a market for distributing apps. That control, Evans argued, leads to inappropriately high prices for consumers and competitors as well as an array of other ills.

Nick Statt:

One of the most curious questions arising from the ongoing Epic Games v. Apple antitrust trial, now on its seventh day of testimony, is why both sides are so intent on establishing their own definitions of basic tech and game industry terms.

Does a phone qualify as a game console, or is it a computer, or both? What’s a special-purpose device, and what’s a general one? But perhaps the most perplexing line of inquiry has been what is and what is not a video game. Is Roblox a game, or just a platform, or maybe it’s an app store? How about Minecraft? What any of this means for the future of Fortnite is still a bit fuzzy, but it’s starting to come into focus with each passing day in court.

Update (2021-05-24): Dave Wood:

Apple’s stat: “470,000 developer accounts terminated” in 2020 doesn’t mean anything. The vast majority of those could have been terminated because the developer moved on and didn’t pay their annual fee.

Epic v. Apple, Day 6

Adi Robertson (tweet):

The trial’s sixth day began with testimony from Matthew Weissinger, Epic’s VP of marketing. And Apple used its cross-examination to offer the court an exhaustive tutorial on Fortnite, beginning with its title screen and one of its skins.

[…]

Peely’s nightmarish existence is barely related to Apple’s case. And the “naked banana” comment would probably have passed for a throwaway joke, but for one very important fact: Apple slammed Epic last week by claiming that it hosted porn.

[…]

Apple’s tutorial was clearly aimed at showing that Fortnite is mostly a game and not an “experience” or “metaverse” — encouraging the judge to weigh the App Store’s game-related policies against similar rules on consoles, rather than scrutinizing the whole iOS ecosystem.

Adi Robertson:

This is an email between Apple and Epic. Apple sender’s requesting assets promoting Chapter 2 launch, says “I know we’ve had issues in the past with a significant art leak,” but he promises it won’t happen again. Spoiler: Apple apparently did leak the Chapter 2 assets.

Adi Robertson:

Evans is back, and lawyer is asking how he defines the market and alternatives here. Evans notes the costs of switching ecosystems to Android are high, PCs/consoles aren’t a substitute, and Apple’s policies prevent the existence of iOS App Store alternatives.

[…]

To bring it back to consumer harm, Evans is arguing that Apple’s lack of competition causes higher prices and a slower pace of innovation. […] Evans says Apple hardware is very innovative but that its work on the App Store hasn’t kept pace, basically.

Previously: