### Initialize xtool Setup Source: https://context7.com/xtool-org/xtool/llms.txt Run `xtool setup` for one-time initialization. This command handles authentication with Apple Developer Services and, on Linux, installs the Darwin Swift SDK. It's recommended for first-time users and can be run interactively. ```bash # Full interactive setup (recommended for first-time users) xtool setup # Prompts: # Select login mode # 0: API Key (requires paid Apple Developer Program membership) # 1: Password (works with any Apple ID but uses private APIs) # Choice (0-1): 1 # Apple ID: dev@example.com # Password: •••••••• # Logging in... # Select a team # 0: Example Corp (A1B2C3D4E5) # Choice (0-0): 0 # Logged in. # Now generating the Darwin SDK. # Path to Xcode.xip: ~/Downloads/Xcode_26.0.1_Apple_silicon.xip # (extracts SDK and installs it via `swift sdk install`) ``` -------------------------------- ### Install App with IntegratedInstaller Source: https://context7.com/xtool-org/xtool/llms.txt Orchestrates app installation by unpacking, provisioning, codesigning, and installing over USB. Implement the delegate protocol for progress updates and device interaction prompts. ```swift // Package.swift dependency: // .package(url: "https://github.com/xtool-org/xtool", .upToNextMinor(from: "1.2.0")) // Target dependency: .product(name: "XKit", package: "xtool") import XKit // 1. Implement the delegate protocol to receive progress updates final class MyInstallerDelegate: IntegratedInstallerDelegate, @unchecked Sendable { func setPresentedMessage(_ message: IntegratedInstaller.Message?) { switch message { case .pairDevice: print("Please trust this computer on your iPhone…") case .unlockDevice: print("Please unlock your iPhone…") case nil: break } } func installerDidUpdate(toStage stage: String, progress: Double?) { if let p = progress { print("\r[\(String(format: "%.0f", p * 100))%] \(stage)", terminator: "") } else { print("\r[ ] \(stage)", terminator: "") } } func confirmRevocation(of certificates: [DeveloperServicesCertificate]) async -> Bool { print("Revoking \(certificates.count) old certificate(s)…") return true // confirm revocation } } // 2. Build auth data from a stored token let token = try AuthToken.saved() let authData = try token.authData() // 3. Create the installer targeting a specific device UDID let delegate = MyInstallerDelegate() let installer = IntegratedInstaller( udid: "00008101-XXXXXXXXXXXXXXXXXXXX", lookupMode: .only(.usb), auth: authData, configureDevice: false, // set true to also enable WiFi sync delegate: delegate ) // 4. Install: accepts either a .ipa or .app URL let appURL = URL(fileURLWithPath: "path/to/MyApp.ipa") let installedBundleID = try await installer.install(app: appURL) print("\nInstalled: \(installedBundleID)") // [100%] Installing… // Installed: XTL-A1B2.com.example.MyApp ``` -------------------------------- ### Verify Swift Installation Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-Linux.md Confirms that the Swift toolchain is correctly installed on your system. ```bash swift --version # should say something like: # Swift version 6.2 (swift-6.2-RELEASE) ``` -------------------------------- ### Install xtool using Homebrew Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-macOS.md Installs xtool via Homebrew for macOS users. This is the recommended installation method if you use Homebrew. ```bash brew install xtool-org/tap/xtool ``` -------------------------------- ### Download and Install xtool Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-Linux.md Downloads the latest xtool AppImage, makes it executable, and moves it to a system-wide binary location. ```bash curl -fL \ "https://github.com/xtool-org/xtool/releases/latest/download/xtool-$(uname -m).AppImage" \ -o xtool chmod +x xtool sudo mv xtool /usr/local/bin/ ``` -------------------------------- ### Install IPA or App Bundle Source: https://context7.com/xtool-org/xtool/llms.txt Signs and installs a pre-built .ipa or .app bundle onto a connected device. Handles all provisioning and codesigning steps automatically. ```bash xtool install path/to/MyApp.ipa ``` ```bash xtool install path/to/MyApp.app ``` -------------------------------- ### Install libimobiledevice-utils on Ubuntu/Debian Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-Linux.md Installs additional utilities for interacting with iOS devices from the command line on Debian-based systems. ```bash sudo apt-get install libimobiledevice-utils # The following NEW packages will be installed: # libimobiledevice-utils # 0 upgraded, 1 newly installed ``` -------------------------------- ### Verify xtool Installation Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-macOS.md Confirms that xtool has been installed correctly and is accessible from the command line. ```bash xtool --help # OVERVIEW: Cross-platform Xcode replacement # ... ``` -------------------------------- ### List Swift SDKs Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-Linux.md Confirms that an iOS Swift SDK has been successfully generated and installed by xtool. ```bash swift sdk list # darwin ``` -------------------------------- ### Verify Swift Installation Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-macOS.md Checks the installed Swift version, ensuring the toolchain is available. This is a prerequisite for using xtool. ```bash swift --version # swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3) # Target: arm64-apple-macosx15.0 ``` -------------------------------- ### Configure xtool Login Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-macOS.md Performs the one-time setup for xtool, including logging in with either an API Key or password. This is required before using xtool. ```bash xtool setup ``` -------------------------------- ### Check usbmuxd Installation Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-Linux.md Verifies if the usbmuxd service is installed and accessible. ```bash usbmuxd --help # Usage: usbmuxd [OPTIONS] # ... ``` -------------------------------- ### Install usbmuxd on Ubuntu/Debian Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-Linux.md Installs the usbmuxd package on Debian-based Linux distributions. ```bash sudo apt-get install usbmuxd ``` -------------------------------- ### IntegratedInstaller Source: https://context7.com/xtool-org/xtool/llms.txt Orchestrates the full pipeline: unpacking an .ipa/.app, pairing with the device, provisioning via Apple Developer Services, codesigning, repackaging, and installing over USB. ```APIDOC ## IntegratedInstaller ### Description Orchestrates the full pipeline: unpacking an `.ipa`/`.app`, pairing with the device, provisioning via Apple Developer Services, codesigning, repackaging, and installing over USB. ### Usage ```swift // Implement the delegate protocol to receive progress updates final class MyInstallerDelegate: IntegratedInstallerDelegate, @unchecked Sendable { func setPresentedMessage(_ message: IntegratedInstaller.Message?) { switch message { case .pairDevice: print("Please trust this computer on your iPhone…") case .unlockDevice: print("Please unlock your iPhone…") case nil: break } } func installerDidUpdate(toStage stage: String, progress: Double?) { if let p = progress { print("\r[\(String(format: \"%.0f\", p * 100))%] \(stage)", terminator: "") } else { print("\r[ ] \(stage)", terminator: "") } } func confirmRevocation(of certificates: [DeveloperServicesCertificate]) async -> Bool { print("Revoking \(certificates.count) old certificate(s)…") return true // confirm revocation } } // Build auth data from a stored token let token = try AuthToken.saved() let authData = try token.authData() // Create the installer targeting a specific device UDID let delegate = MyInstallerDelegate() let installer = IntegratedInstaller( udid: "00008101-XXXXXXXXXXXXXXXXXXXX", lookupMode: .only(.usb), auth: authData, configureDevice: false, // set true to also enable WiFi sync delegate: delegate ) // Install: accepts either a .ipa or .app URL let appURL = URL(fileURLWithPath: "path/to/MyApp.ipa") let installedBundleID = try await installer.install(app: appURL) print("\nInstalled: \(installedBundleID)") ``` ``` -------------------------------- ### Develop and Deploy iOS Apps with xtool Source: https://context7.com/xtool-org/xtool/llms.txt The `xtool dev` command builds and installs your SwiftPM iOS app on a connected device. It handles authentication, provisioning, signing, and deployment. Use subcommands like `build` for standalone builds or `run --simulator` for simulator testing on macOS. ```bash cd MyApp # Build + install on physical device (default subcommand) xtool dev # Planning... # (SwiftPM builds for arm64-apple-ios) # Waiting for devices to be connected... # Installing to device: Kabir's iPhone (udid: 00008101-XXXXXXXXXXXX) # Provisioning... # Signing... # Packaging... # Installing... # Build only — output a .app bundle xtool dev build # Wrote to xtool/MyApp.app # Build only — output a .ipa file xtool dev build --ipa # Packaging... 100% # Wrote to xtool/MyApp.ipa # Build with release configuration xtool dev build --configuration release # Build + run on iOS Simulator (macOS only) xtool dev run --simulator # Generate an Xcode project (macOS only) xtool dev generate-xcode-project ``` -------------------------------- ### Customize Info.plist content Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Control.md Example of a custom Info.plist file content. This snippet shows how to set UI interface orientations and display name. ```plist UISupportedInterfaceOrientations UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight CFBundleDisplayName My App ``` -------------------------------- ### Launch App on Device Source: https://context7.com/xtool-org/xtool/llms.txt Launches an installed app on a connected device by its bundle ID. Supports forwarding optional launch arguments to the app. ```bash xtool launch com.example.MyApp ``` ```bash xtool launch com.example.MyApp -- --reset-state --verbose ``` -------------------------------- ### Run xtool in Docker Container Source: https://github.com/xtool-org/xtool/blob/main/Linux/README.md Spawns a shell inside a Docker container with the xtool root directory bind-mounted. Ensure Docker and Docker Compose are installed. ```bash docker compose run --rm xtool ``` -------------------------------- ### Manage Darwin Swift SDK Source: https://context7.com/xtool-org/xtool/llms.txt Installs, removes, or checks the status of the Darwin Swift SDK for cross-compiling iOS apps on Linux. Requires a downloaded Xcode.xip file. ```bash xtool sdk install ~/Downloads/Xcode_26.0.1_Apple_silicon.xip ``` ```bash xtool sdk status ``` ```bash xtool sdk remove ``` ```bash xtool sdk build ~/Downloads/Xcode_26.0.1_Apple_silicon.xip /tmp/my-sdk --arch arm64 ``` -------------------------------- ### Forward Host usbmuxd to Docker Source: https://github.com/xtool-org/xtool/blob/main/Linux/README.md Listens on TCP port 27015 on the host and forwards connections to the usbmuxd socket. This command must remain running while the Docker container needs to access iOS devices. Requires socat to be installed on the host. ```bash socat -dd TCP-LISTEN:27015,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/run/usbmuxd ``` -------------------------------- ### Uninstall App from Device Source: https://context7.com/xtool-org/xtool/llms.txt Uninstalls an installed app from a connected iOS device using its bundle ID. Provides feedback on success or failure. ```bash xtool uninstall com.example.MyApp ``` -------------------------------- ### Preview Documentation Locally Source: https://github.com/xtool-org/xtool/blob/main/CONTRIBUTING.md Run this command in the project directory to preview the documentation locally. Ensure swift-docc is set up. ```shell make docs-preview ``` -------------------------------- ### Initialize xtool.yml Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Control.md Create a basic xtool.yml file with version and bundleID. This is a prerequisite for many xtool configurations. ```bash cat > xtool.yml << EOF version: 1 bundleID: com.example.Hello EOF ``` -------------------------------- ### Build and Deploy App with Extension using xtool Source: https://context7.com/xtool-org/xtool/llms.txt Build and deploy the main app and its extensions together using the xtool dev command. ```bash # Build and deploy app + widget together xtool dev ``` -------------------------------- ### Create New iOS Project with xtool Source: https://context7.com/xtool-org/xtool/llms.txt Use `xtool new ` to scaffold a new xtool-compatible SwiftPM package. This command generates essential project files including `Package.swift`, `xtool.yml`, and basic SwiftUI app structure. ```bash xtool new MyApp # Creating package: MyApp # Creating Package.swift # Creating xtool.yml # Creating .gitignore # Creating .sourcekit-lsp/config.json # Creating Sources/MyApp/MyAppApp.swift # Creating Sources/MyApp/ContentView.swift # # Finished generating project MyApp. Next steps: # - Enter the directory with `cd MyApp` # - Build and run with `xtool dev` # Generated xtool.yml: cat MyApp/xtool.yml # version: 1 # bundleID: com.example.MyApp # Generated Package.swift target (library product — required by xtool): # .library(name: "MyApp", targets: ["MyApp"]) ``` -------------------------------- ### Include SwiftPM resources Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Control.md Configure Swift Package Manager to copy resource files into the app bundle. Use this for assets like images. ```swift targets: [ .target( name: "Hello", resources: [.copy("Blob.png")] ), ] ``` -------------------------------- ### Configure App Extension in xtool.yml Source: https://context7.com/xtool-org/xtool/llms.txt Declare app extensions in xtool.yml, specifying the product name and Info.plist path. ```yaml # xtool.yml version: 1 bundleID: com.example.MyApp product: MyApp extensions: - product: MyWidget infoPath: MyWidget-Info.plist ``` -------------------------------- ### xtool CLI Help Source: https://github.com/xtool-org/xtool/blob/main/README.md Displays the help information for the xtool command-line interface, outlining available subcommands and options. ```bash $ xtool --help OVERVIEW: Cross-platform Xcode replacement USAGE: xtool OPTIONS: -h, --help Show help information. CONFIGURATION SUBCOMMANDS: setup Set up xtool for iOS development auth Manage Apple Developer Services authentication sdk Manage the Darwin Swift SDK DEVELOPMENT SUBCOMMANDS: new Create a new xtool SwiftPM project dev Build and run an xtool SwiftPM project ds Interact with Apple Developer Services DEVICE SUBCOMMANDS: devices List devices install Install an ipa file to your device uninstall Uninstall an installed app launch Launch an installed app See 'xtool help ' for detailed help. ``` -------------------------------- ### Define App Extension in Package.swift Source: https://context7.com/xtool-org/xtool/llms.txt Add an app extension as a separate library product in the Package.swift file. ```swift // Package.swift — add the extension as a separate library product let package = Package( name: "MyApp", platforms: [.iOS(.v17)], products: [ .library(name: "MyApp", targets: ["MyApp"]), .library(name: "MyWidget", targets: ["MyWidget"]), ], targets: [ .target(name: "MyApp"), .target(name: "MyWidget"), ] ) ``` -------------------------------- ### Configure xtool.yml for Extension Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Appex.md Update your xtool.yml to specify the main application product and list your extension products. Include the `infoPath` for each extension. ```yaml version: 1 bundleID: com.example.Hello product: Hello extensions: - product: HelloWidget infoPath: HelloWidget-Info.plist ``` -------------------------------- ### Verify Xcode SDK Path Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Installation-macOS.md Confirms that Xcode is correctly set up with the iOS SDK. This is a prerequisite for using xtool. ```bash xcrun -sdk iphoneos -show-sdk-path # /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.4.sdk ``` -------------------------------- ### Create App Entitlements File Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Control.md Create an `App.entitlements` file with the necessary entitlements, such as `com.apple.developer.homekit` for HomeKit device connectivity. ```plist com.apple.developer.homekit ``` -------------------------------- ### Build xtool AppImage Source: https://github.com/xtool-org/xtool/blob/main/Linux/README.md Executes the build script to create an AppImage for xtool. The resulting AppImage will be located at packages/xtool.AppImage. ```bash ./build.sh ``` -------------------------------- ### Copy top-level resources Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Control.md Specify files to be copied directly to the root of the app bundle using the 'resources' key in xtool.yml. Useful for files like GoogleServices-Info.plist. ```yaml resources: - Resources/GoogleServices-Info.plist ``` -------------------------------- ### Add Widget Library to Package.swift Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Appex.md Declare a new library product for the widget extension in your Package.swift file. This makes the extension target available for xtool. ```swift // swift-tools-version: 6.0 import PackageDescription let package = Package( name: "Hello", platforms: [.iOS(.v17)], products: [ .library( name: "Hello", targets: ["Hello"]) , .library( name: "HelloWidget", targets: ["HelloWidget"]) ], targets: [ .target(name: "Hello") , .target(name: "HelloWidget") ] ) ``` -------------------------------- ### Configure xtool for Entitlements Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Control.md Tell xtool about your entitlements file by specifying its path in the `xtool.yml` configuration file. ```yaml entitlementsPath: App.entitlements ``` -------------------------------- ### Create Widget Extension Info.plist Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Appex.md Define the Info.plist for your Widget Extension. The `NSExtensionPointIdentifier` must be set to `com.apple.widgetkit-extension` for widget extensions. ```xml NSExtension NSExtensionPointIdentifier com.apple.widgetkit-extension ``` -------------------------------- ### Parse and Validate xtool.yml with PackSchema Source: https://context7.com/xtool-org/xtool/llms.txt Load and validate the xtool.yml configuration file. Supports loading from a file or creating programmatically. ```swift import PackLib // Load from the current directory let schema = try await PackSchema(url: URL(fileURLWithPath: "xtool.yml")) print(schema.bundleID ?? "no explicit bundleID") print(schema.infoPath ?? "no custom Info.plist") print(schema.iconPath ?? "no custom icon") print(schema.extensions?.count ?? 0, "app extension(s)") // Create programmatically and validate let base = PackSchemaBase( version: .v1, bundleID: "com.example.MyApp", infoPath: "Resources/Info.plist", iconPath: "Resources/AppIcon.png", resources: ["Resources/GoogleService-Info.plist"]) let validated = try PackSchema(validating: base) // Throws StringError if version is unsupported or both bundleID and orgID are missing ``` -------------------------------- ### Build xtool for Debugging Source: https://github.com/xtool-org/xtool/blob/main/CONTRIBUTING.md Execute this command in the project root to build xtool for debugging. This command may prompt for codesigning identity selection on macOS. ```shell make ``` -------------------------------- ### Add XKit as SwiftPM Dependency Source: https://github.com/xtool-org/xtool/blob/main/README.md Shows how to add the XKit library, which provides programmatic access to Apple Developer Services and iOS device interactions, as a Swift Package Manager dependency to your project. ```swift .package(url: "https://github.com/xtool-org/xtool", .upToNextMinor(from: "1.2.0")) ``` ```swift .product(name: "XKit", package: "xtool") ``` -------------------------------- ### Set app icon path Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Control.md Configure xtool to use a specific image file as the app icon. The image should be a PNG, ideally 1024x1024px. ```yaml iconPath: Resources/AppIcon.png ``` -------------------------------- ### Specify custom Info.plist path Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Control.md Tell xtool where to find your custom Info.plist file. This allows you to add or modify Info.plist keys. ```yaml infoPath: path/to/Info.plist ``` -------------------------------- ### App Extension Info.plist Configuration Source: https://context7.com/xtool-org/xtool/llms.txt Configure the Info.plist for an app extension, specifying the NSExtensionPointIdentifier. ```xml NSExtension NSExtensionPointIdentifier com.apple.widgetkit-extension ``` -------------------------------- ### SwiftUI Widget Implementation Source: https://github.com/xtool-org/xtool/blob/main/Documentation/xtool.docc/Appex.md This code defines a basic WidgetKit widget with a static configuration and a simple timeline provider. It displays the current date and refreshes hourly. ```swift import WidgetKit import SwiftUI @main struct Bundle: WidgetBundle { var body: some Widget { HelloWidget() } } struct HelloWidget: Widget { var body: some WidgetConfiguration { StaticConfiguration( kind: "HelloWidget", provider: Provider() ) { VStack { Text(entry.date, style: .date) } .containerBackground(.fill.tertiary, for: .widget) } .configurationDisplayName("HelloWidget") .description("This is an example widget.") } struct Entry: TimelineEntry { var date = Date() } struct Provider: TimelineProvider { func placeholder(in context: Context) -> Entry { Entry() } func getSnapshot( in context: Context, completion: @escaping (Entry) -> Void ) { completion(Entry()) } func getTimeline( in context: Context, completion: @escaping (Timeline) -> Void ) { completion(Timeline( entries: [Entry()], policy: .after(.now + 3600) )) } } } ``` -------------------------------- ### Provision and Codesign App with AutoSigner Source: https://context7.com/xtool-org/xtool/llms.txt Drives Apple Developer Services provisioning and codesigns an app bundle using zsign. Call this directly or use it internally via IntegratedInstaller. Requires a SigningContext and provides status updates. ```swift import XKit let context = try SigningContext( auth: authData, targetDevice: .init(udid: deviceUDID, name: "Kabir's iPhone") ) let signer = AutoSigner(context: context) { certificatesToRevoke in // Called when existing developer certificates must be revoked to create a new one. print("Will revoke \(certificatesToRevoke.count) certificate(s)") return true // confirm revocation } let bundleID = try await signer.sign( app: URL(fileURLWithPath: "xtool/MyApp.app"), status: { stage in print("[\(stage)]") }, progress: { progress in if let p = progress { print(" \(Int(p * 100))%") } } ) // [Provisioning] // 50% // [Signing] // 100% print("Signed bundle ID: \(bundleID)") // e.g. "XTL-A1B2.com.example.MyApp" ``` -------------------------------- ### List Connected Devices Source: https://context7.com/xtool-org/xtool/llms.txt Lists all iOS devices connected via USB or network, displaying their names, connection types, and UDIDs. Supports filtering and non-waiting behavior. ```bash xtool devices ``` ```bash xtool devices --usb ``` ```bash xtool devices --no-wait ``` -------------------------------- ### xtool.yml Project Configuration Source: https://context7.com/xtool-org/xtool/llms.txt Configure your xtool project using `xtool.yml`. This file controls aspects of the `.app` bundle, including bundle ID, `Info.plist` merging, entitlements, resources, and app icon. It supports defining a `bundleID` directly or using `orgID` to auto-derive bundle IDs. ```yaml # Minimal configuration version: 1 bundleID: com.example.MyApp # OR use orgID to auto-derive bundle IDs per product: # version: 1 # orgID: com.example ``` -------------------------------- ### Interact with Apple Developer Services Source: https://context7.com/xtool-org/xtool/llms.txt Programmatically query and manage Apple Developer Services resources such as teams, certificates, devices, App IDs, and provisioning profiles. ```bash xtool ds teams list ``` ```bash xtool ds certificates list ``` ```bash xtool ds devices list ``` ```bash xtool ds identifiers list ``` ```bash xtool ds profiles list ``` -------------------------------- ### Interact with Developer Services using DeveloperServicesClient Source: https://context7.com/xtool-org/xtool/llms.txt Provides a typed interface to Apple Developer Services API for Xcode. Use it to list teams, register devices, and manage provisioning profiles. Requires password-based authentication. ```swift import XKit // Requires password-based auth token guard case let .xcode(xcodeAuth) = try AuthToken.saved().authData() else { fatalError("Requires password login mode") } let client = DeveloperServicesClient(authData: xcodeAuth) // List development teams let teams: [DeveloperServicesTeam] = try await client.send(DeveloperServicesListTeamsRequest()) for team in teams { print("\(team.name) [\(team.status)]: \(team.id.rawValue)") // Example Corp [active]: A1B2C3D4E5 } // Register a new device let addedDevice = try await DeveloperServicesAddDeviceOperation( udid: "00008101-XXXXXXXXXXXX", name: "Kabir's iPhone", context: signingContext ).perform() print("Registered: \(addedDevice.udid ?? "?")") ``` -------------------------------- ### AutoSigner Source: https://context7.com/xtool-org/xtool/llms.txt Drives Apple Developer Services provisioning and codesigns the .app bundle using zsign. Can be called directly or is used internally by IntegratedInstaller. ```APIDOC ## AutoSigner ### Description Provisions and codesigns an app bundle using Apple Developer Services and zsign. It handles certificate, App ID, and provisioning profile management. ### Usage ```swift import XKit let context = try SigningContext( auth: authData, targetDevice: .init(udid: deviceUDID, name: "Kabir's iPhone") ) let signer = AutoSigner(context: context) { certificatesToRevoke in // Called when existing developer certificates must be revoked to create a new one. print("Will revoke \(certificatesToRevoke.count) certificate(s)") return true // confirm revocation } let bundleID = try await signer.sign( app: URL(fileURLWithPath: "xtool/MyApp.app"), status: { stage in print("[\(stage)]") }, progress: { progress in if let p = progress { print(" \(Int(p * 100))%") } } ) print("Signed bundle ID: \(bundleID)") // e.g. "XTL-A1B2.com.example.MyApp" ``` ``` -------------------------------- ### DeveloperServicesClient Source: https://context7.com/xtool-org/xtool/llms.txt Provides a typed interface to the private Apple Developer Services API used by Xcode, backed by password-based authentication. ```APIDOC ## DeveloperServicesClient ### Description Provides a typed interface to the private Apple Developer Services API used by Xcode, enabling management of teams, App IDs, devices, and provisioning profiles. ### Usage ```swift import XKit // Requires password-based auth token guard case let .xcode(xcodeAuth) = try AuthToken.saved().authData() else { fatalError("Requires password login mode") } let client = DeveloperServicesClient(authData: xcodeAuth) // List development teams let teams: [DeveloperServicesTeam] = try await client.send(DeveloperServicesListTeamsRequest()) for team in teams { print("\(team.name) [\(team.status)]: \(team.id.rawValue)") // Example Corp [active]: A1B2C3D4E5 } // Register a new device let addedDevice = try await DeveloperServicesAddDeviceOperation( udid: "00008101-XXXXXXXXXXXX", name: "Kabir's iPhone", context: signingContext ).perform() print("Registered: \(addedDevice.udid ?? "?")") ``` ``` -------------------------------- ### Manage Authentication Credentials Source: https://context7.com/xtool-org/xtool/llms.txt Manages stored Apple Developer Services credentials, supporting API Key or password-based authentication. Includes login, status check, and logout functionalities. ```bash xtool auth login ``` ```bash xtool auth login --mode key \ --username YOUR_KEY_ID \ # (prompts for Issuer ID and path to .p8 key file) ``` ```bash xtool auth login --mode password \ --username dev@example.com \ --password "s3cr3t" ``` ```bash xtool auth status ``` ```bash xtool auth logout ``` ```bash xtool auth logout --reset-2fa ``` -------------------------------- ### Update macOS Codesigning Team ID Source: https://github.com/xtool-org/xtool/blob/main/CONTRIBUTING.md Use this command to update the saved team ID for macOS codesigning. This is useful if you have multiple identities or need to change the selected team. ```shell make team ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.