This post is mostly a brain dump of what it takes to use Swift for command line scripting.
#!/usr/bin/env xcrun --toolchain <X> swift import Foundation
The first step is to decide which version of Swift you want to use. Replace
<X> with the toolchain identifier from
. . .
I came to remind you of what you once knew
Bar Ziony was asking about using type erasure to create a property that can contain any possible adopter of a protocol, but without using generics. I posted a gist but wanted to go over it in more detail, plus answer some follow-up questions.
We'll start with a protocol and two types that adopt the protocol:
protocol . . .
The Apple File System is still a slightly mysterious beast. Apple has reason to be cautious: A new file system is always a huge undertaking and the risks couldn't be higher: a serious bug can cause complete data loss.
AFPS is intended to replace CoreStorage, FileVault, and the iOS variants of HFS+. That's a lot of functionality!
. . .
A brave new world
Xcode 8 now supports an official extension API. The first extension type supported is the Source Editor extension (though probably not the last). The flip-side is that Xcode 8 adopts System Integrity Protection. That means it is no longer possible to inject code into the Xcode process. Alcatraz is closed for business.
Basics of XcodeKit . . .
It's Unsafe Pointers All The Way Down
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
NSCoder or plists.
Instead I want to do this purely in Swift and mostly analogous to what you'd do in C because it's . . .
It's rabbit holes all the way down
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 that's really an orthogonal issue and . . .
Sure, let's go down this rabbit hole again
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 better explanation for why . . .