Created
July 20, 2015 03:23
-
-
Save brentsimmons/5ccd357f0fa1486bdc3f to your computer and use it in GitHub Desktop.
Class is unknown until runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How do you do this in Swift? | |
- (Class)classToUse { | |
return [Foo class]; // assume it's something else sometimes | |
} | |
- (id)generateThingForString:(NSString *)s { | |
Class thingClass = [self classToUse]; | |
return [[thingClass alloc] initWithString:s]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment