Archive for November 6, 2015

Friday, November 6, 2015

Flickr for iOS 9


On the iPhone 6s and iPhone 6s Plus, we’ve added 3D Touch support, enabling you to preview photos, people, notifications and more with a light press of your screen.


New in iOS 9, 3D Touch “Quick Actions” let you do the things you do most often, faster and in fewer steps. Lightly press our app icon to upload a photo, skip directly to notifications or the feed or to kick off a search right from your homescreen.


With universal link support, links you send or receive will now open directly in the Flickr app, instead of as a web page in Safari.

Why Is Swift’s String API So Hard?

Mike Ash:

Incidentally, I think that representing all these different concepts as a single string type is a mistake. Human-readable text, file paths, SQL statements, and others are all conceptually different, and this should be represented as different types at the language level. I think that having different conceptual kinds of strings be distinct types would eliminate a lot of bugs.


Swift’s String type takes a different approach. It has no canonical representation, and instead provides views on various representations of the string. This lets you use whichever representation makes the most sense for the task at hand.


Going from an arbitrary sequence of UTF-16 code units back to a String is pretty obscure. UTF16View has no public initializers and few mutating functions. The solution is to use the global transcode function, which works with the UnicodeCodecType protocol. There are three implementations of this protocol: UTF8, UTF16, and UTF32. The transcode function can be used to convert between them. It’s pretty gnarly, though. For the input, it takes a GeneratorType which produces the input, and for the output it takes a function which is called for each unit of output. This can be used to build up a string piece by piece by converting to UTF32, then converting each UTF-32 code unit to a UnicodeScalar and appending it to a String[…]


The various views are all indexable collections, but they are very much not arrays. The index types are weird custom structs. This means you can’t index views by number […] Instead, you have to start with either the collection’s startIndex or endIndex, then use methods like successor() or advancedBy() to move around […] Why not make it easier, and allow indexing with an integer? It’s essentially Swift’s way of reinforcing the fact that this is an expensive operation.

Shoot the Heap

Russ Bishop:

Ah, the joys of non-garbage-collected languages. I spent some time debugging a retain cycle today and thought I’d share the process I used to locate and fix the cycle. Along the way, we’ll see how the Leaks instrument is a dirty filthy liar, watch as Xcode inexplicably mixes old and new code into the same binary yielding impossible behavior, and finally figure out how to use heap shots (or as the new Allocations instrument calls them Generations) to find the retain cycle even in the midst of a retain/release history thousands of entries long.

Home File Sharing via Flash Drive

John Gordon:

Dropbox, Google Drive and OneDrive all move our family data into the Cloud — and I’d like to not worry about that. Sync solutions mean new software, but perhaps only on one machine.

I’m going to stick our unused $20 SanDisk Ultra Fit 64GB flash drive in back of the Airport Extreme.


This Apple article partly explains what is supposed to happen. From Airport Utility we can create username/password “accounts”. Say “Parent” and “Kids”. When a client connects you are asked username/password, that gives access to the Folder of the same name as well as a “Shared” folder. So Emily and I connect as “Parents” and see the “Parents”  and “Shared” folder, but we don’t see a “Kids” folder unless we connect with that username password.

There’s no way for me to connect with to the AE shared disk (partitions?) and see everything.

It’s so nice to be able to use USB flash drives and SD cards for smaller backups and shared volumes. They’re compact, and there are no cables or power supplies to worry about.

Apps Sharing User Data

Dan Goodin:

Apps in both Google Play and the Apple App Store frequently send users’ highly personal information to third parties, often with little or no notice, according to recently published research that studied 110 apps.

The researchers analyzed 55 of the most popular apps from each market and found that a significant percentage of them regularly provided Google, Apple, and other third parties with user e-mail addresses, names, and physical locations. On average, Android apps sent potentially sensitive data to 3.1 third-party domains while the average iOS app sent it to 2.6 third-party domains. In some cases, health apps sent searches including words such as “herpes” and “interferon” to no fewer than five domains with no notification that it was happening.


iOS apps, meanwhile, most often sent third parties a user’s current location, with 47 percent of apps analyzed in the study transmitting such data. In total, 18 percent of apps sent names, and 16 percent of apps sent e-mail addresses. The Pinterest app sent names to four third-party domains, including,, and

How Swift Implements Generics

Chris Lattner (via Erica Sadun):

The semantic model of swift generics is that they use runtime dispatch through “witness tables” provided by the protocol conformances of the generic types. This model allows for fast -O0 compiles and separate compilation of generics.

The problem with this model is that actually relying on this for everything would produce code that runs very slowly. To solve this problem, the optimizer uses heuristic-driven generic specialization that does code duplication where it thinks that it is profitable and sensible.

The way to contrast C++ and Swift is: C++ eagerly duplicates code in the frontend (and hopefully the optimizer can eliminate some of the copies later, with LTO…). Swift does not generate any copies in the front-end, but does generate them in the optimizer.


We are still on track to open source Swift (including Linux support) “by the end of 2015” as promised, more details will come out when they can.