Poolside FM

Poolside FM

I fucking love Poolside FM. It's like the perfect playlist for summer. The only problem is I always had to keep it open in a tab on my browser. I was constantly accidentally closing the thing and because it's a website, it's not controllable through the media keys on your keyboard. I had a sift through their source and stumbled across their API. I tweeted that I'd love to build a little menubar app for Poolside. It would be a nice to have thing and I wanted to build my first Mac app. The Poolside guys Marty & Grant seemed…

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 To make…

Easy Form Validation in Swift

I come from a very web-centric background and have used frameworks like Laravel in the past extensively. One of the things I really loved about that framework in particular was the way in which it handled validation. If you don't know, Laravel just takes an associative array (think: dictionary) of field names and a set of rules. I looked for a similar class or package to do the same in Swift but couldn't find anything so I wrote something to do it. SRFormValidator If you can't be fucked to read the rest of the post and want to get straight…

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…