Archive for March 12, 2015

Thursday, March 12, 2015

iMessage’s Send Read Receipts

Garrett Murray:

Why did I enable it begin with? I’ve complained in the past on numerous occasions that I’d really like my wife to know when I’ve read a message. It’s annoying to be at the grocery store and receive a “don’t forget eggs!” message only to receive a followup “please let me know you saw this” message a few minutes later. I always want my wife to know when I read her messages—they’re generally action items or requests and she wants confirmation (this same requirement goes the other way, obviously). Ideally, iMessage would allow for per-contact or per-group settings for sending read receipts, but it doesn’t. It should! But it doesn’t. So if I want Stacey to know when I’ve read her messages, I have to let everyone know. Boy oh boy does that complicate things.

Wrapping libxml2 for Swift

Janie Clayton:

I have included the profiler in my sample code for this project, but in case you don’t feel like running it yourself, my benchmarking showed that using libxml2 was four times faster than tree-based NSXMLDocument parsing and three times faster than event-based NSXMLDocument parsing.


I was becoming incredibly confused and frustrated when Brad had me add a println() in LibXMLDoc between when we initialize the document and when we initialize the root node. It turns out that ARC was deleting the LibXMLDoc immediately after it was being initialized because it wasn’t being held on to or referenced anywhere. D’oh!


The solution utilized here was to replace the strongly referenced LibXMLNode root node with a private, internal weak root node and a computed property checking to see if this internal root node has been set yet. If it has, it is returned. If it hans’t, we extract the root node, set it to the internal root node, and return it.


And this, kids, is why you still need to think about memory management and ARC even if you started coding after iOS 5, like I did.

Touch Input During Animations

John Gruber:

William Van Hecke made an interesting video showing a difference in iOS 7 and 8 from all prior versions of iOS — touch gestures are now ignored during system animations.


I think it’s more like the old animations ended abruptly, whereas starting in iOS 7 they ease out slowly. The difference isn’t between being interruptible or not, but rather between ending quickly and ending slowly. The result, though, is what matters, and the result is that it feels slower.


Neven Mrgan:

OneShot tried, and shaved off some work from this task, and that’s helpful enough. If it got it wrong, oh well, no harm done. My instinct says Apple wouldn’t ship a feature like this—they’d want it to work 100% of the time, or not at all.

I’d like to see more software try to do a good job of a fuzzy task, let you help it with the last mile, and give you a fallback option. That kind of magic can be more delightful than behind-the-scenes, guess-and-stick-with-it magic we’re often promised.

The Minus Sign

Ole Begemann:

The default behavior of NSNumberFormatter is to use the hyphen-minus to format negative numbers. Considering that the class can be used not just for output formatting but also for parsing strings, this default makes sense. Almost every data interchange format (think JSON) uses the hyphen-minus to represent a minus sign.

But if you need to format negative numbers for display in your app, your text will look much more professional if you use the real minus sign. Fortunately, this is easy. All you need to do is create a string with the correct minus sign character and assign it to your number formatter’s minusSign property.

How to Proof EPUBs on the iPad With iBooks

Michael E. Cohen:

The unexpected demise of Book Proofer caused many book developers (a small but proud community of which I am a member) more than a little consternation. Without Book Proofer one has to go through the arduous process of editing an EPUB’s files, packaging them all up inside an EPUB file, loading that EPUB into iBooks, reviewing the results, and then, if the results aren’t as desired, deleting the book from iBooks, and engaging in another round of editing, packaging, and loading.


As if to add insult to injury, the iBooks app that ships with Yosemite ostensibly offers a way out with its Advanced > Add ePub to Library as Proof command. (You must first enable the Advanced menu in iBooks > Preferences > Advanced.) Frustratingly, though, that command doesn’t seem to work. Choose it, and you see a standard Mac file dialog in which EPUBs show up as unselectable!

However, it turns out that the command does work, just not with a normal EPUB file. Here’s the trick — in four-part harmony — for making it work.