Skip to content

Instantly share code, notes, and snippets.

@veeneck
Created June 9, 2015 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veeneck/dd6ae65579e4de7b6825 to your computer and use it in GitHub Desktop.
Save veeneck/dd6ae65579e4de7b6825 to your computer and use it in GitHub Desktop.
componentForClass
func componentForClass<ComponentType : GKComponent>(componentClass: ComponentType.Type) -> ComponentType? {
for component in self.components {
if let temp = component as? ComponentType {
return temp
}
}
return nil
}
@veeneck
Copy link
Author

veeneck commented Jun 9, 2015

Note: This has to extend GKEntity to work. Re: self.components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment