Ha IOS Concurrency
Developmentha-ios-concurrencyHa IOS Concurrency is an Agent Skill for development published in the home-assistant/iOS repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Asynchronous code and server networking conventions. Use when writing async/await, Tasks, actors, or Combine, deciding whether to touch PromiseKit, annotating view models with @MainActor, or calling the Home Assistant server via HAKit.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/home-assistant/iOS/blob/HEAD/.agents/skills/ha-ios-concurrency/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/ha-ios-concurrency, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Concurrency & Networking
Concurrency
Prefer Swift Concurrency (async/await, Task, actors, structured concurrency) for all new asynchronous code.
- Do not introduce new PromiseKit code. PromiseKit is a legacy dependency that the codebase is gradually moving away from. Parts of
HomeAssistantAPI(HAAPI.swift) still use it, so don't assume a full migration — but new work should useasync/awaitinstead ofPromise/Guarantee. - When touching existing PromiseKit code, migrate it to
async/awaitwhere practical rather than extending the PromiseKit usage. - Use
Combineonly where an existing reactive pattern already requires it; otherwise preferasync/awaitandAsyncStream/AsyncSequence. - Annotate SwiftUI-facing view models with
@MainActor.
Networking
Use HAKit (the Home Assistant Swift SDK) for server communication:
- REST API calls via
HAConnection - WebSocket subscriptions for real-time updates
- Connection info managed through
Current.servers - Prefer
async/awaitfor new request flows (see Concurrency above); avoid adding new PromiseKit-based calls.