Developer guide

Bring your app to SwiftDeck.

Choose a simple URL action or connect your app with SwiftDeckKit.

This guide shows you how to add SwiftDeck integration to your own app and define controls that people can place in SwiftDeck to operate its features.

Choose the Integration that suits your needs

Choose your app language

The page shows only the instructions for your choice.

SDK Free Integration

The Lite option is useful for one simple action, such as opening a document or choosing a tool. SwiftDeck opens a special URL that your app understands. You do not need SwiftDeckKit, a developer account or a connection that stays open. The Lite option cannot add controls automatically, show current values or support sliders and lists. For those features, .

1

Choose and register a URL scheme

In Xcode, select your Mac app target and open Info → URL Types. Add a URL scheme that is unique to your app. The example uses example-hello. Replace it with your own name in both your app and SwiftDeck.

Any app on the Mac can try to open this URL. Use it only for actions that are safe for other apps to request.

2

Handle the incoming URL in your app

Add this function to the part of your app that receives opened URLs. In a SwiftUI app, call it from onOpenURL. In an AppKit app, call it from the URL-opening function in the app delegate. It accepts only the exact URL used in this example.

Example URL handlerSwift
import AppKit

// Call this when your app receives an opened URL.
func handleSwiftDeckURL(_ url: URL) {
    guard url.scheme == "example-hello",
          url.host == "swiftdeck",
          url.path == "/hello",
          URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems?.isEmpty != false
    else { return }

    let alert = NSAlert()
    alert.messageText = "Hello World"
    alert.runModal()
}

The alert is only an example. Once the test works, replace it with the action your app should perform.

3

Test the URL before opening SwiftDeck

Build and run your Mac app. Paste this command into Terminal on the same Mac. Replace the example scheme if you chose a different one.

Open the test URLTerminal
open "example-hello://swiftdeck/hello"

The Hello World alert should appear. If it does not, check the URL Types entry and make sure your app passes opened URLs to this function.

4

Create the action in SwiftDeck

In SwiftDeck, add a button to a deck and choose URL Scheme Action. Enter example-hello://swiftdeck/hello, then set a clear title such as Hello World. Press it on your connected device while the Mac app is installed.

The SwiftDeck user creates each Lite action. Your app cannot add the control to App Controls or send current values back to SwiftDeck. Lite actions also cannot provide sliders or lists. for those features.