Skip to content

Instantly share code, notes, and snippets.

@kostiakoval
Last active March 15, 2017 23:55
Show Gist options
  • Save kostiakoval/945f70af0cfcc4270807 to your computer and use it in GitHub Desktop.
Save kostiakoval/945f70af0cfcc4270807 to your computer and use it in GitHub Desktop.
NSClassFromString in playground!
import Foundation
class Playground : NSObject {
static var bundleVersion: String {
let s = self.description().stringByReplacingOccurrencesOfString(".Playground", withString:"")
return s
}
}
let version = Playground.bundleVersion
class AA {
}
let a = NSClassFromString("\(version).AA")
a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment