Code-free
Code-free

Packing Bytes in Swift

It's Unsafe Pointers All The Way Down

Russ Bishop
May 12, 2016

Today I want to do a small exercise in packing some Float32s into a SQLite Binary Large Object (BLOB) column. Sure I could use JSON, protobuf, or some other encoding. Yes I could also use NSNumber, NSArray, and NSCoder or plists.

Instead I want to do this purely in Swift and mostly analogous to what you'd do in C because . . .

Read More

Swift: Why Associated Types?

It's rabbit holes all the way down

Russ Bishop
May 03, 2016

Associated Types Series

In my last article I gave an incorrect explanation for why Swift has associated types. It was half-correct in that specific knowledge of the types gives the compiler the ability to optimize but . . .

Read More

Swift Associated Types, cont.

Sure, let's go down this rabbit hole again

Russ Bishop
April 28, 2016

Update: I originally hit publish too soon; this is the updated article.

I don't feel like I fully covered one aspect of protocols with associated types: why can they be such a pain to work with?

Why Associated Types

This rabbit hole just keeps on going; see my third article in the Associated Types series for a . . .

Read More

Functors, Applicatives, and Monads in Plain English

This is a no-bullshit zone

Russ Bishop
April 18, 2016

Let's learn what Monads, Applicatives, and Functors are, only instead of relying on obscure functional vocabulary or category theory we'll just, you know, use plain english instead.

Functors

Functors are containers you can call map on. That's it. Seriously.

A million words of category theory and Haskell . . .

Read More

Type Erasure

It's parameters all the way down

Russ Bishop
April 11, 2016

Update: You can read even more about type erasure with lots of example code

A friend of mine @purpleyay gave a talk at try! Swift in Japan about type erasure this week last month. For those of us who didn't attend, what's the deal with type erasure anyway?

More specifically, what is type erasure in the context of . . .

Read More

Bridges of Siracusa County

ObjectiveCBridgeable

Russ Bishop
April 04, 2016

We live in an imperfect world. It isn't always practical to throw out all your Objective-C code and start over. Framework authors (including Apple) are even more constrained: lots of apps aren't 100% Swift and won't ever be. Making the next version of Photos.framework only available to Swift is a non-starter.

What's a . . .

Read More

Warning: Photos.framework may unleash Zalgo

Russ Bishop
February 27, 2016

For the most part the new Photos.framework is a refreshing replacement for the old Asset Library interface. It was so clearly built to handle the massive (and every increasing) size of photo libraries.

Sore Spots

There are a few sore spots. The first is annoying but minor: The title that Photos displays for an individual . . .

Read More

Archive
   Subscribe by email and never miss a post.