{"id":15055355,"url":"https://github.com/elgatosf/streamdeck-kit-ipad","last_synced_at":"2025-04-10T03:40:38.633Z","repository":{"id":224539880,"uuid":"747229264","full_name":"elgatosf/streamdeck-kit-ipad","owner":"elgatosf","description":"Swift library for controlling Stream Deck hardware from an iPadOS application.","archived":false,"fork":false,"pushed_at":"2024-04-18T11:01:43.000Z","size":58506,"stargazers_count":7,"open_issues_count":3,"forks_count":0,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-05-09T04:10:17.126Z","etag":null,"topics":["ipad","ipados","library","streamdeck-api","streamdeck-sdk","streamdeck-tools","swift","swiftpackage","swiftui"],"latest_commit_sha":null,"homepage":"https://docs.elgato.com/ipad","language":"Swift","has_issues":true,"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/elgatosf.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-23T14:24:45.000Z","updated_at":"2024-08-21T12:54:50.644Z","dependencies_parsed_at":"2024-08-21T12:54:41.855Z","dependency_job_id":"3ae5eb4c-8278-41fd-af65-c25dbf2cad4d","html_url":"https://github.com/elgatosf/streamdeck-kit-ipad","commit_stats":null,"previous_names":["elgatosf/streamdeck-kit-ipad"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elgatosf%2Fstreamdeck-kit-ipad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elgatosf%2Fstreamdeck-kit-ipad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elgatosf%2Fstreamdeck-kit-ipad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elgatosf%2Fstreamdeck-kit-ipad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elgatosf","download_url":"https://codeload.github.com/elgatosf/streamdeck-kit-ipad/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154798,"owners_count":21056541,"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":["ipad","ipados","library","streamdeck-api","streamdeck-sdk","streamdeck-tools","swift","swiftpackage","swiftui"],"created_at":"2024-09-24T21:41:20.045Z","updated_at":"2025-04-10T03:40:38.613Z","avatar_url":"https://github.com/elgatosf.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"Documentation/_images/StreamDeckKit.svg\" alt=\"The Stream Deck Kit logo\" /\u003e\n\n# Stream Deck Kit\n\nStream Deck Kit is a Swift Library for controlling physical [Elgato Stream Deck](https://www.elgato.com/stream-deck) devices with an iPadOS app.\n\n![Code checks workflow badge](https://github.com/elgatosf/streamdeck-kit-ipad/actions/workflows/code-checks.yml/badge.svg)\n\n## Features\n\nThe Stream Deck for iPad SDK is tailored for a seamless plug-and-play experience on iPadOS. Here, your application takes control when it comes to the foreground, dictating the appearance and functions of the Stream Deck's buttons, and for the Stream Deck +, managing its rotary knobs and touchscreen interactions.\n\nAll Stream Deck devices:\n- Handle key up/down events\n\nDevices with LED keys:\n- Set images onto keys\n- Set background images\n- Render keys and backgrounds with SwiftUI\n\nDevices with Rotary encoders:\n- Handle rotation and up/down events\n\nDevices with touch displays:\n- Draw onto touch display\n- Render touch display content with SwiftUI\n\n## Prerequisites\n\nTo interact with a physical Stream Deck device, ensure you have the following:\n\n- An iPad with a USB-C jack and Apple silicon chip (at least M1)\n- The [Elgato Stream Deck Connect](https://apps.apple.com/app/elgato-stream-deck-connect/id6474433828) app installed\n- The Stream Deck Device Driver enabled in iOS settings app (Refer to the in-app instructions for guidance)\n\nHowever, if you want to verify your implementation using the [Stream Deck Simulator](#utilizing-the-simulator) only, no additional prerequisites are necessary.\n\n| iOS Version | Swift Version | XCode Version |\n| ----------- | ------------- | ------------- |\n| \u003e= 16       | \u003e= 5.9        | \u003e= 15         |\n\n## Installation\n\n### Package\n\nYou can add the library to your XCode project via Swift Package Manager. See \"[Adding package dependencies to your app](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app)\".\n\nIf you want to add it to your own libraries `Package.swift`, use this code instead:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/elgatosf/streamdeck-kit-ipad.git\", upToNextMajor: \"1.1.0\")\n]\n```\n\n### Entitlements\n\nIn order to connect to the Stream Deck driver, you need to add the \"[Communicates with Drivers](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_driverkit_communicates-with-drivers)\" (`com.apple.developer.driverkit.communicates-with-drivers`) capability to your app target. Refer to \"[Adding capabilities to your app](https://developer.apple.com/documentation/xcode/adding-capabilities-to-your-app/)\" for guidance.\n\n## Getting started\n\nRendering content on a Stream Deck is very simple with SwiftUI, much like designing a typical app UI.\n\n```swift\nimport StreamDeckKit\n\nStreamDeckSession.setUp(newDeviceHandler: { $0.render(Color.blue) })\n```\n\nThis code snippet demonstrates rendering a blue color across all buttons and displays on a device.\n\n\u003e [!NOTE]\n\u003e `StreamDeckSession` operates as a singleton, meaning you should invoke `setUp` only once throughout your application's life cycle.\n \n### Rendering Layouts \n\nTo render content on specific areas, utilize the `StreamDeckLayout` system. `StreamDeckLayout` provides predefined layout views to position content on a Stream Deck. \n\n```swift\nimport StreamDeckKit\n\nStreamDeckSession.setUp(newDeviceHandler: { $0.render(MyFirstStreamDeckLayout()) })\n```\n\n```swift\nimport SwiftUI \nimport StreamDeckKit\n\nstruct MyFirstStreamDeckLayout: View {\n\n    @Environment(\\.streamDeckViewContext.device) var streamDeck\n\n    var body: some View {\n        StreamDeckLayout {\n            // Define key area\n            // Use StreamDeckKeyAreaLayout for rendering separate keys\n            StreamDeckKeyAreaLayout { keyIndex in\n                // Define content for each key.\n                // StreamDeckKeyAreaLayout provides an index for each available key,\n                // and StreamDeckKeyView provides a callback for the key action\n                // Example:\n                StreamDeckKeyView { pressed in\n                    print(\"pressed \\(pressed) at index \\(keyIndex)\")\n                } content: {\n                    Text(\"\\(keyIndex)\")\n                        .frame(maxWidth: .infinity, maxHeight: .infinity)\n                        .background(.teal)\n                }\n            }.background(.purple)\n        } windowArea: {\n            // Define window area\n            if streamDeck.info.product == .plus {\n                // Use StreamDeckDialAreaLayout for Stream Deck +\n                StreamDeckDialAreaLayout { dialIndex in\n                    // Define content for each dial\n                    // StreamDeckDialAreaLayout provides an index for each available dial,\n                    // and StreamDeckDialView provides callbacks for the dial actions\n                    // Example:\n                    StreamDeckDialView { rotations in\n                        print(\"dial rotated \\(rotations)\")\n                    } press: { pressed in\n                        print(\"pressed \\(pressed)\")\n                    } touch: { location in\n                        print(\"touched at \\(location)\")\n                    } content: {\n                        Text(\"\\(dialIndex)\")\n                            .frame(maxWidth: .infinity, maxHeight: .infinity)\n                            .background(Color(white: Double(dialIndex) / 5 + 0.5))\n                    }\n                }\n            } else if streamDeck.info.product == .neo {\n                // Use StreamDeckNeoPanelLayout for Stream Deck Neo\n                StreamDeckNeoPanelLayout { touched in\n                    print(\"left key touched \\(touched)\")\n                } rightTouch: { touched in\n                    print(\"right key touched \\(touched)\")\n                } panel: {\n                    Text(\"Info Panel\")\n                }\n                .background(.yellow)\n            }\n        }.background(.indigo)\n    }\n\n}\n```\n\n\u003cimg src=\"Documentation/_images/layout_sd_plus_device.png\" alt=\"A screenshot of a Stream Deck +, showing increasing numbers on it's buttons\" width=\"200\" /\u003e\n\nFor instructions on how to react to state changes, refer to [Handling state changes](Documentation/Layout/Stateful.md).\n\n### Utilizing the Simulator\n\nThe SDK is equipped with a fully operational simulator, providing a convenient way to to verify your implementation on various devices. However, we recommend to conduct testing on a real device as well. \n\n\u003e [!NOTE]\n\u003e The simulator attaches to your running `StreamDeckSession`, mimicking the behavior of a regular device.\n\nExecuting this code presents the Stream Deck Simulator as an overlay featuring a simulated Stream Deck:\n\n```swift\nimport StreamDeckSimulator\n\nButton(\"Show Stream Deck Simulator\") {\n    StreamDeckSimulator.show()\n}\n```\n\n\u003cimg src=\"Documentation/_images/simulator.png\" alt=\"A screenshot of the Stream Deck simulator window\" width=\"200\" /\u003e\n\nFor further instructions, refer to [Simulator](Documentation/Simulator.md).\n\n#### Previews\n\nYou can use Simulator in XCode Previews. \n\n```swift\n#Preview {\n    StreamDeckSimulator.PreviewView(streamDeck: .mini) { device in\n        device.render(MyStreamDeckLayout())\n    }\n}\n```\n\n### Verify Stream Deck Connect Installation\n\nIn your app, consider addressing the scenario where Stream Deck Connect, and consequently, its driver, is not installed on the user's device. In such cases, you could prompt users with a message instructing users to install the app and enable the driver before utilizing your app with Stream Deck.\n\nTo determine if Stream Deck Connect is installed within your project, use the following snippet with `canOpenURL` and its scheme:\n\n```swift\nUIApplication.shared.canOpenURL(URL(string: \"elgato-device-driver://\")!)\n```\n\nEnsure to include `\"elgato-device-driver\"` in the `LSApplicationQueriesSchemes` section of your Info.plist file.\n\n## Contribution\n\nThis project adheres to the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). By participating, you are expected to uphold this code. Please report unacceptable behavior to project owners.\n\n## License\n\nStream Deck Kit is released under the MIT license. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felgatosf%2Fstreamdeck-kit-ipad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felgatosf%2Fstreamdeck-kit-ipad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felgatosf%2Fstreamdeck-kit-ipad/lists"}