Archive for September 8, 2014

Monday, September 8, 2014

Swifter

Swifter is auto-generated documentation for Swift’s standard library (via Ole Begemann).

Update (2015-01-05): Swifter is now SwiftDoc.org:

The change in name is meant to mark the beginning of a process: to give the Swift community a site that is both more useful and one we can all be involved with.

To that end, I’ve put the code for the parser/builder that converts the Swift header file into this site, and the code to the site itself, in repositories on GitHub. Moreover, the site itself is now hosted via GitHub Pages. Plans are in the making for the coming weeks that will involve, you, Gentle Reader, so watch this space.

Raw​Option​Set​Type

Mattt Thompson:

When interacting with frameworks like Foundation in Swift, all of those NS_ENUM declarations are automatically converted into an enum—often improving on the original Objective-C declaration by eliminating naming redundancies […] Unfortunately, for NS_OPTIONS, the Swift equivalent is arguably worse.

[…]

Compared to the syntactically concise enum declaration, RawOptionsSetType is awkward and cumbersome, requiring over a dozen lines of boilerplate for computed properties.

Phone Sizes

Lukas Mathis:

The interesting thing is that there are a lot of iPhone owners out there for whom — relative to the size of their hands — their iPhone is already bigger than the Galaxy Note was for the men who wrote those articles. It didn’t occur to those authors that their hands were probably larger than most women’s hands, and that the experience they had with the Note wasn’t altogether unlike how many women feel while using their iPhones today.

In that context, it shouldn’t have been a surprise that the Note turned out to sell well — after all, in relative terms, a lot of iPhone owners were already using very large phones.

[…]

That’s why phone size is such a difficult topic. It depends on you, and it depends on what you do with it. I’m glad that Apple is about to introduce a larger phone, but I also still believe there are people who would benefit from an additional phone that’s even smaller than the 4S.

John Gruber:

The thing is, I’m not laughing. You wanted Apple to make a 5.5-inch iPhone? This is what you get.

Core Data Batch Updates

Geppy Parziale:

First of all, Apple introduced a new method executeRequest:error: in the NSManagedObjectContext class. It is very similar to the executeFetchRequest:error: method that you can use to perform a fetch request to populate the Managed Object Context. Its first argument is a NSBatchUpdateRequest. This is a new class, subclass of the NSPersistentStoreRequest recently introduced in iOS 7, and provides very similar functionalities to its sibling NSFetchRequest. The batch request is composed of an entity (the entity containing the property or properties you want to update) and a predicate to define a subset of data you want to update. Eventually, you can also define a dictionary containing the properties you want to update and their new values.

Once created, the NSBatchUpdateRequest is passed to the executeRequest:error: method. After its execution, this method returns an NSBatchUpdateResult object (subclass of NSPersistentStoreResult), the result property of which contains the batch updates result value(s). You can define the type of results you want from the executeRequest:error:, when you define the NSBatchUpdateRequest. You choose among three types of results:

[…]

The legacy Fetch-Update-Save takes 7.2s to run on the iPhone 5s, while the new batch updates run in only 0.81 s.

Impressive is also the memory usage. As expected, since the batch updates run directly on the Persistent Store, the memory usage is incredibly lower than the old approach.

I’ve been wanting something like this for a long time. (Note that it doesn’t handle deletion.)

Thoughts on ADN and Dropbox

Clark Goble:

For most people ADN is yesterday’s news. It’s considered as dead as the dodo. However there’s actually still a pretty good community going on there. As people have noted the signal to noise ratio has gone up quite a bit. Unfortunately the people who run ADN don’t seem to share the hope that some of the continuing users have. Which makes it a bit of a self-fulfilling prophecy. I know a few people with innovative clients there aren’t finishing because it doesn’t seem worth the effort. 

The best hope for ADN is for some other company like DropBox to make a competitor that uses ADN’s excellent APIs. Even the critics of ADN and its management always acknowledged that in terms of actual engineering it was an amazingly well designed system.

How to Correct Siri’s Pronunciation

Christopher Breen:

When Siri mispronounces a name, reply “That’s not how you say that.” Siri will respond with “OK, how do you pronounce the name (firstname)?” where firstname is that contact’s first name. Say the first name and Siri offers you three pronunciation choices. Tap each sample and then tap Select next to the one closest to the pronunciation you prefer. If none of them are as close as you’d like, you can tap Tell Siri Again and she’ll take another stab at it.