Decoding Dreamweaver STE files with Swift

Decoding Dreamweaver STE files with Swift

We have a few clients that use Dreamweaver as their editor/FTP client of choice. This unfortunately doesn't fit in with our toolchain and as we often receive STE files it's a manual process to extract the data from the file. Since we use the amazing Transmit from Panic I wondered if there was a way we could parse the file from Dreamweaver and open a new connection in Transmit. Decoding The Password First of all I wanted to see if it was actually possible to decode the password before I bothered building anything. Thankfully, the heavy lifting of figuring…

Content blockers are easy. Content blockers are hard.

Content blockers are easy. Content blockers are hard.

So today, Mr. Crumble — Cocoon's latest app — is out. It's a content blocker for iOS 9 but unlike other content blockers it's not bothered about ads but instead it targets those annoying EU cookie banners. Building a content blocker is both easy and hard at the same time. Wait what? What I mean by that is building the the actual app couldn't be easier. It's basically a shell with a background task to fetch updates from a database every few hours. Now that's where the hard part is… Assembling a database. Assembling a database Apple allows content blockers two options:…

Make UILabel Copyable in Swift

I've been working on an iOS app that called for some text to be copyable but not editable. I wanted to able to long-press and have the contextual menu show the "Copy" action. I'd initially thought about using a UITextField and disabling the edit functionality to achieve this. However that caused some issues with keyboards popping up even when editing was disabled. It struck me as strange that a UILabel isn't copyable. At least by default, as it turns out is actually fairly easy to make it so we can copy and paste out label value. Subclassing UILabel…

Swift "AnyClass" Type

TL;DR you're looking for MyClass.self When working with ConnectSDK, I came across something I hadn't before in Swift: the AnyClass type. ConnectSDK is an Objective-C based library so I'd imagine this is a rarity when working with native Swift code. Here's what it looks like: discoveryManager?.registerDeviceService(deviceClass: AnyClass!, withDiscovery: AnyClass!) I mistakenly though it was looking for an instance (i.e. MyClass()) but that threw an error. It turns out that in Objective-C each class has the static class property. In the case of ConnectSDK it's looking for the following: [AirPlayService class] [DIALService class] [CastService class] This…

Creating a Delegate in Swift

The Delegate pattern is one that's widely used is developing apps for iOS and OS X and it's one that's very simple to implement in Swift. It's primarily used to alert classes of changes or interactions in other instances. For example, UITableView's delegate has a variety of methods of which include notifying when a cell has been selected or edited. Apple describes a delegate as the following in their documentation: A delegate is an object that acts on behalf of, or in coordination with, another object when that object encounters an event in a program. Delegate == Protocol Creating a delegate…