{"id":13992378,"url":"https://github.com/JarnoLeConte/streamdeck-template-swift","last_synced_at":"2025-07-22T15:32:12.198Z","repository":{"id":51105125,"uuid":"216347269","full_name":"JarnoLeConte/streamdeck-template-swift","owner":"JarnoLeConte","description":"Template for creating a Stream Deck plugin in Swift","archived":false,"fork":false,"pushed_at":"2021-05-23T18:58:01.000Z","size":1100,"stargazers_count":59,"open_issues_count":3,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-10T14:10:01.091Z","etag":null,"topics":["elgato","macos","streamdeck","streamdeck-sdk","swift","template"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JarnoLeConte.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":"2019-10-20T10:57:00.000Z","updated_at":"2024-05-05T13:43:03.000Z","dependencies_parsed_at":"2022-08-20T07:01:24.951Z","dependency_job_id":null,"html_url":"https://github.com/JarnoLeConte/streamdeck-template-swift","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/JarnoLeConte%2Fstreamdeck-template-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JarnoLeConte%2Fstreamdeck-template-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JarnoLeConte%2Fstreamdeck-template-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JarnoLeConte%2Fstreamdeck-template-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JarnoLeConte","download_url":"https://codeload.github.com/JarnoLeConte/streamdeck-template-swift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227133784,"owners_count":17735808,"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":["elgato","macos","streamdeck","streamdeck-sdk","swift","template"],"created_at":"2024-08-09T14:01:58.104Z","updated_at":"2024-11-29T13:30:28.481Z","avatar_url":"https://github.com/JarnoLeConte.png","language":"Objective-C","readme":"# Stream Deck Plugin Template: Swift\n\nUse this template for creating a new [Stream Deck](https://www.elgato.com/gaming/stream-deck) plugin written in Swift (macOS only).\nImplementation is based on the example plugin `AppleMail` provided by [Elgato](https://github.com/elgatosf/streamdeck-applemail) written in Objective-C.\n\n\n# Description\n\nIf you want to create your own Stream Deck plugin for Mac, you can use this template if you prefer to write it in [Swift](https://docs.swift.org/swift-book/LanguageGuide/TheBasics.html).\n\n\n# Features\n\n- boilerplate to setup plugin and handle events\n- code written in Swift\n- make use of Objective-C libraries\n- macOS only\n\n![](screenshot.png)\n\n\n# Getting started\n\n1. The Sources folder contains the source code of the plugin.\n2. Open the `StreamDeckPlugin.xcodeproj` in Xcode.\n3. Start writing code in `Plugin.swift` where you can handle events like `keyDown`, `keyUp`, `willAppear`, etc...\n4. Send commands to Stream Deck using the `connectionManager` instance available in `Plugin.swift`.\n5. Finnaly you plugin should be bundled in the folder `com.COMPANYNAME.PLUGINNAME.sdPlugin` (replace `COMPANYNAME` and `PLUGINNAME`), and add a `manifest.json` file and other resources such as images.\n\n# Events\n\nThis are all events that you can handle in `Plugin.swift`:\n\n```Swift\npublic func keyDown(forAction action: String, withContext context: Any, withPayload payload: [AnyHashable : Any], forDevice deviceID: String) {\n    // Nothing to do\n}\n\npublic func keyUp(forAction action: String, withContext context: Any, withPayload payload: [AnyHashable : Any], forDevice deviceID: String) {\n    // Nothing to do\n}\n\npublic func willAppear(forAction action: String, withContext context: Any, withPayload payload: [AnyHashable : Any], forDevice deviceID: String) {\n    // Nothing to do\n}\n\npublic func willDisappear(forAction action: String, withContext context: Any, withPayload payload: [AnyHashable : Any], forDevice deviceID: String) {\n    // Nothing to do\n}\npublic func deviceDidConnect(_ deviceID: String, withDeviceInfo deviceInfo: [AnyHashable : Any]) {\n    // Nothing to do\n}\n\npublic func deviceDidDisconnect(_ deviceID: String) {\n    // Nothing to do\n}\n\npublic func applicationDidLaunch(_ applicationInfo: [AnyHashable : Any]) {\n    // Nothing to do\n}\n\npublic func applicationDidTerminate(_ applicationInfo: [AnyHashable : Any]) {\n    // Nothing to do\n}\n```\n\nIf you need to handle other events you have to define them yourself in `Common/ESDEventsProtocol.h` and dispatch them in `Common/ESDConnectionManager.m`.\n\n# Send commands to Stream Deck\n\nIf you want to send something to the Stream Deck, you can use the methods defined on the `connectionManager`. The `connectionManager` implements the following methods. You can call them from inside the event handlers.\n\n```swift\nconnectionManager?.setTitle(\"New title\", withContext: context, withTarget: ESDSDKTarget.HardwareAndSoftware.rawValue)\n\nconnectionManager?.setImage(someBase64ImageString, withContext: context, withTarget: ESDSDKTarget.HardwareOnly.rawValue)\n\nconnectionManager?.showAlert(forContext: context)\n\nconnectionManager?.showOK(forContext: context)\n\nconnectionManager?.setSettings([\"key1\": \"value1\", \"key2\": \"value2\"], forContext: context)\n\nconnectionManager?.setState(1, forContext: context)\n\nconnectionManager?.logMessage(\"Some log message\")\n\n```\n\nIf you want to call some other stream deck method, you have to define it yourself in `Common/ESDConnectionManager.m` and implement it in `Common/ESDConnectionManager.m`.\n\n# More information\n\nMore information about writing Stream Deck plugins in general can be found on the [Developer section](https://developer.elgato.com/documentation/stream-deck/sdk/overview/) at the web site of [Elgato](https://developer.elgato.com/documentation/stream-deck/sdk/overview/).\n","funding_links":[],"categories":["Objective-C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJarnoLeConte%2Fstreamdeck-template-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJarnoLeConte%2Fstreamdeck-template-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJarnoLeConte%2Fstreamdeck-template-swift/lists"}