Stephen Radford
  • Blog
  • Email
Subscribe
Tagged

Code

A collection of 2 posts

Swift

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:

  • Stephen Radford
Stephen Radford Sep 5, 2015 • 1 min read
Development

Creating a sharedInstance in Swift

Or, "How the fuck to I make a singleton?" One of the patterns that seems to be very common in Cocoa is the sharedInstance pattern. You can see it in a few of the native classes to UIKit and Cocoa. For example: In UIApplication you havesharedApplication which returns

  • Stephen Radford
Stephen Radford Aug 3, 2015 • 1 min read
Stephen Radford © 2022
Powered by Ghost