{"id":18551385,"url":"https://github.com/chaoscoder/appletvsimulatorcontroller","last_synced_at":"2025-05-15T10:30:48.747Z","repository":{"id":145959989,"uuid":"45295154","full_name":"ChaosCoder/AppleTVSimulatorController","owner":"ChaosCoder","description":"tvOS Simulator Game Controller","archived":false,"fork":false,"pushed_at":"2015-10-31T09:16:11.000Z","size":235,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T10:30:38.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChaosCoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-31T08:53:19.000Z","updated_at":"2020-04-19T17:24:47.000Z","dependencies_parsed_at":"2023-04-11T12:16:51.500Z","dependency_job_id":null,"html_url":"https://github.com/ChaosCoder/AppleTVSimulatorController","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChaosCoder%2FAppleTVSimulatorController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChaosCoder%2FAppleTVSimulatorController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChaosCoder%2FAppleTVSimulatorController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChaosCoder%2FAppleTVSimulatorController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChaosCoder","download_url":"https://codeload.github.com/ChaosCoder/AppleTVSimulatorController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254322729,"owners_count":22051652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T21:08:54.736Z","updated_at":"2025-05-15T10:30:48.724Z","avatar_url":"https://github.com/ChaosCoder.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apple TV Simulator Game Controller\n\nIn tvOS the Apple TV remote can act as a game controller and is accessed through the Game Controller framework. As of Xcode 7.1 beta 2, though, the Game Controller framework is not supported in the Apple TV Simulator. This project provides a GCController implementation that will work with the simulator for testing. You can read more about its development at [Game Controller Support For Apple TV Simulator](http://iosdevstuff.blogspot.com/2015/10/game-controller-support-for-apple-tv.html).\n## Usage\nAdd the files in the Controller directory to your project. GameViewController.swift provides an example of how to integrate it. The following sections describe each step.\n### Conditionally create controller\n```\n#if arch(i386) || arch(x86_64)\n    scene.controller = createSimulatorController()\n#else\n    NSNotificationCenter.defaultCenter().addObserver(self, selector: \"handleControllerDidConnectNotification:\", name: GCControllerDidConnectNotification, object: nil)\n    NSNotificationCenter.defaultCenter().addObserver(self, selector: \"handleControllerDidDisconnectNotification:\", name: GCControllerDidDisconnectNotification, object: nil)\n#endif\n```\n### Register gesture recognizers\nThe controller depends on a few gesture recognizers that you'll need to add to your view.\n```\nfunc createSimulatorController() -\u003e SimulatorController {\n    let controller = SimulatorController()\n    controller.createGestureRecognizers().forEach { view.addGestureRecognizer($0) }\n    return controller\n}\n```\n### Forward touch events\nYou'll need to forward touch events to the controller.\n```\n#if arch(i386) || arch(x86_64)\noverride func pressesBegan(presses: Set\u003cUIPress\u003e, withEvent event: UIPressesEvent?) {\n    if let controller = scene?.controller as? SimulatorController {\n        controller.pressesBegan(presses, withEvent: event)\n    }\n}\n    \noverride func pressesChanged(presses: Set\u003cUIPress\u003e, withEvent event: UIPressesEvent?) {\n}\n    \noverride func pressesCancelled(presses: Set\u003cUIPress\u003e, withEvent event: UIPressesEvent?) {\n    if let controller = scene?.controller as? SimulatorController {\n        controller.pressesCancelled(presses, withEvent: event)\n    }\n}\n    \noverride func pressesEnded(presses: Set\u003cUIPress\u003e, withEvent event: UIPressesEvent?) {\n    if let controller = scene?.controller as? SimulatorController {\n        controller.pressesEnded(presses, withEvent: event)\n    }\n}\n#endif\n```\n## Caveats\nThis is a work around to allow limited Game Controller testing with the Apple TV simulator until Apple provides that functionality. It is not a compelete implementation of the Game Controller classes. A few things not implemented are:\n\n* GCController.handlerQueue: all callbacks are delivered on the same thread that feeds keyboard events and gestures to the controller\n* GCController.motion: returns nil\n\n## License\nAppleTVSimulatorController is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaoscoder%2Fappletvsimulatorcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchaoscoder%2Fappletvsimulatorcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaoscoder%2Fappletvsimulatorcontroller/lists"}