Archive for October 10, 2018

Wednesday, October 10, 2018

Swift Nil-coalescing Performance Trap

Ben Cohen (via Ole Begemann):

?? [] is a significant performance and correctness trap.

Not because [] creates an array unnecessarily (it doesn’t, the empty array is a static singleton in the standard library via a performance hack that gives me heartburn).

It’s because when the array isn’t nil, the presence of ?? [] affects the type checker in ways you don’t expect[…]

[…]

So what does maybeHugeRange?.reversed() ?? [] do? The ReversedCollection answer won’t type check, because the rhs of ?? can’t be one. So instead it falls back to the version on forward-only collections. That returns an array. So now, just because of that ?? [], we are attempting to allocate and fill an array of size Int.max. Which blows up.

SE-0231 (Swift Evolution):

This proposal introduces optional iteration (for?) and hence the possibility to use optional sequences as the corresponding attribute in for-in loops.

[…]

The ? notation here is a semantic emphasis rather than a functional unit: there is no for!. Syntactically marking an optional iteration is redundant, however, in constrast to switch, nil values are skipped silently. Swift strives to follow a style where silent handling of nil is acknowledged via the ? sigil, distinctly reflected in optional chaining. This decision was primarily based on inconsistency and potential confusion that an otherwise left without syntactic changes for-in loop could potentially lead to (“clarity over brevity”).

History of Uber’s Design

Eli Schiff:

Not only that, but this is a critical time in Uber’s ascendence, as it is on the precipice of going public in 2019. A lot is at stake. In that context, it makes sense why several weeks ago on September 12, 2018, Uber played the classic PR-dampening move—launching a major brand announcement during an Apple keynote.

[…]

Most publications missed the patterned 2016 icon as though Uber’s prior rebrand had never occurred. But the remaining few writers who did cover any interim icon ignored that Uber has transitioned icons not once, not even twice, but five times between 2016 and 2018.

Out of the recent icon redesigns, the first and most controversial iteration came in February 2016, featuring a bit (rounded rectangle) and atom (circle) motif overlaid on a patterned teal base. This icon bucked the trend of flatness with a minor, almost-invisible dropshadow.

[…]

This time, Khosrowshahi wasn’t going to leave anything in the rebrand to chance. Unlike in Kalanick’s 2015 “passion project,” in 2018, Khosrowshahi left design to the pros at Wolff Olins (branding), MCKL (type), Ueno (development) and R/GA (development), in collaboration with the Uber Brand Experience Team. What was the advantage of leaning on external designers? Uber itself couldn’t be blamed for any bad outcomes.

The Battle for the Home

Ben Thompson:

If the first stage of competition in consumer technology was the race to be the computer users went to (won by Microsoft and the PC), and the second was to be the computer users carried with them (won by Apple in terms of profits, and Google in terms of marketshare), the outlines of the current battle came sharply into focus over the last month: what company will win the race to be the computer within which users live?

[…]

There is one final question that overshadows all-of-this: while the home may be the current battleground in consumer technology, is it actually a distinct product area — a new epoch if you will? When it came to mobile, it didn’t matter who had won in PCs; Microsoft ended up being an also-ran.

The fortunes of Apple, in particular, depend on whether or not this is the case. If it is a truly new paradigm, than it is hard to see Apple succeeding. It has a very nice speaker, but everything else about its product is worse. On the other hand, the HomePod’s close connection to the iPhone and Apple’s overall ecosystem may be its saving grace: perhaps the smartphone is still what matters.

Previously: Initial HomePod Sales.

Update (2018-10-22): Joe Rossignol:

Apple’s HomePod is the ninth most popular smart speaker model in the United States, according to an online survey of 1,011 smart speaker users conducted by research firm Strategy Analytics in July and August.

Marco Arment:

I like my HomePod, but there are still three huge problems compared to the Echo that sits next to it:

- Siri is much slower to respond than Alexa

- Siri isn’t as reliable as Alexa

- The HomePod ecosystem is limited to a single device, and it’s too expensive.

Why Apple Doesn’t Allow Custom Watch Faces

Marco Arment:

It’s great for Apple to offer a wide variety of Apple Watch faces, but most of them are short-lived novelties at best. We’re three years and four generations into the Apple Watch, and almost every Watch owner I know still uses the same handful of “good” faces.

If you want digital time with a good deal of complications, Modular is your only good choice (or Infograph Modular on the Series 4). If you want analog time with numerals, Utility is the only good option. If you want indices instead of numerals — probably the most popular analog watch style in the world — I don’t think there is a good option.

[…]

And we’re restricted to the handful of good watch faces that Apple makes, because other developers aren’t allowed to make custom Watch faces.

[…]

In a time when personal expression and innovation in watch fashion should be booming, they’re instead being eroded, as everyone in the room is increasingly wearing the same watch with the same two faces.

Renaud Lienhart:

The simple reason why Apple doesn’t allow 3rd party watch faces: the vast majority of them would be copyright-infringing, trademark-stealing lookalikes of the mechanical watchmakers’ designs. Apple would be liable for allowing them and be drowning in lawsuits in no time.

Charles Arthur:

think Apple is wary. Got sued over Swiss clock design ripoff in iOS 6, which is a LONG time ago. Clearly hurt. it’s all fine until you get stung for a ton of money.

Jean-Louis Gassée:

True: Rolex, Omega, Patek value their “trade dress”. Recognizable, intended to say something about the wearer.

Marco Arment:

I’ve gotten this theory a lot, and it’s absolutely a valid concern.

But they already have people submitting copyright and trademark violations all the time at a much higher volume, and a process for dealing with them, with the App Store.

Update (2018-10-11): Steve Troughton-Smith:

As so many people were asking, I put my sample Apple Watch ‘face’ project on GitHub. If you want to use this as a jumping off point to prototype your own Watch faces, go nuts!

Update (2018-10-26): Uluroo:

Apple calls the Watch its most personal device ever. What a recent surge of enthusiasm — led by Marco Arment and Steve Troughton-Smith — has been all about is simple: this personal device is missing personalization in the most important, most powerful, most obvious way possible.

[…]

For an upheaval akin to the App Store to occur on the Apple Watch, the device’s key interaction point needs to be opened up, just as the iPhone’s was. And that brings us to what everyone has been begging Apple to allow since the inception of the device: third-party watch faces.

[…]

Lots of major developers have been dropping out of the Watch’s App Store; this would send them running back. Uluroo would bet money that there were some ideas for Apple Watch experiences that got scrapped because they made more sense as a watch face than as an app.

Apple’s War on iPhone Fraud in China

Wayne Ma:

Five years ago, Apple was forced to temporarily close what was then its only retail store in Shenzhen, China, after it was besieged by lines of hundreds of customers waiting to swap broken iPhones for new devices, according to two former Apple employees who were briefed about the matter. In May 2013, the Shenzhen store logged more than 2,000 warranty claims a week, more than any other Apple retail store in the world, one of those people said.

After some investigation, Apple discovered the skyrocketing requests for replacements was due to a highly sophisticated fraud scheme run by organized teams. Rings of thieves were buying or stealing iPhones and removing valuable components like CPUs, screens and logic boards, replacing them with fake components or even chewing gum wrappers, more than a half-dozen former employees familiar with the fraud said. The thieves would then return the iPhones, claiming they were broken, and receive replacements they could then resell, according to three of those people.

Joe Rossignol:

Hesitant to get Chinese authorities involved, due to the risks of public backlash and negative publicity in state-run media, Apple launched an online reservation system that required proof of ownership, and later developed diagnostic software that allowed retail employees to quickly detect fake parts in iPhones.

Fraudsters found ways to evade these tactics, however, and even went as far as obtaining Apple customer records, including serial numbers, for iPhones that had already been sold in China.

[…]

Apple also began dipping batteries in a special dye that could only be seen under a high-frequency light to authenticate them during repairs, the report says. A-series chips in iPhones are also allegedly coated in a waterproof sealant that can be seen under certain wavelengths, offering another countermeasure.