Created
June 9, 2015 17:01
-
-
Save veeneck/dd6ae65579e4de7b6825 to your computer and use it in GitHub Desktop.
componentForClass
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
func componentForClass<ComponentType : GKComponent>(componentClass: ComponentType.Type) -> ComponentType? { | |
for component in self.components { | |
if let temp = component as? ComponentType { | |
return temp | |
} | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: This has to extend GKEntity to work. Re: self.components.