swift-macos
macOS apps with Swift 6.3, SwiftUI, SwiftData, Swift Concurrency, Foundation Models, Swift Testing, and ScreenCaptureKit. Use when building native Mac apps - windows, menus, SwiftData, on-device AI, capture, AppKit bridges, notarization. Skill: swift-macos Owner: tenequm Summary: macOS apps with Swift 6.3, SwiftUI, SwiftData, Swift Concurrency, Foundation Models, Swift Testing, and ScreenCaptureKit. Use when building native Mac apps - windows, menus, SwiftData, on-device AI, capture, AppKit bridges, notarization. Tags: latest:0.8.4 Version history: v0.8.4 | 2026-10-07T18:42:32.530Z | user Updated swift-macos from 0.8.3 to 0.8.4. Changes: - modified C
Rank
62
Safety
84
Downloads
1.9k
Updated
Oct 9, 2026
Version
0.8.4
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.9K downloads reported by the source. Last updated 10/9/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 9, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 9, 2026
- Adoption signal
- 1.9K downloadsadoption · observed Oct 9, 2026
- Latest release
- 0.8.4release · observed Oct 7, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s17bp3v1hm1dnkzey0c9tfh02183j0y5:swift-macos- Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-tenequm-swift-macos/snapshot"
Documentation
CLAWHUB
155,160 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
--- name: swift-macos description: macOS apps with Swift 6.3, SwiftUI, SwiftData, Swift Concurrency, Foundation Models, Swift Testing, and ScreenCaptureKit. Use when building native Mac apps - windows, menus, SwiftData, on-device AI, capture, AppKit bridges, notarization. metadata: version: "0.8.4" categories: "development" topics: "swift, swiftui, macos, swiftdata, screencapturekit" upstream: "[email protected], [email protected], [email protected]" openclaw: homepage: https://github.com/tenequm/skills/tree/main/skills/swift-macos emoji: "🍎" os: - macos --- # macOS App Development - Swift 6.3 Build native macOS apps with Swift 6.3 (latest: 6.3.3, bundled in Xcode 26.6, Jun 2026), SwiftUI, SwiftData, and macOS 26 Tahoe (26.6.2 current). Target macOS 14+ for SwiftData/@Observable, macOS 15+ for latest SwiftUI, macOS 26 for Liquid Glass and Foundation Models. Note Xcode 26.6 still bundles the macOS **26.5** SDK, so 26.6-only API is not yet buildable. For the WWDC 2026 beta stack (macOS 27, Xcode 27, Swift 6.4, shipping fall 2026), see `references/fall-2026-releases.md`. ## Quick Start ```swift import SwiftUI import SwiftData @Model final class Project { var name: String var createdAt: Date // Named ProjectTask, not Task - `Task` would shadow `Swift.Task` @Relationship(deleteRule: .cascade) var tasks: [ProjectTask] = [] init(name: String) { self.name = name self.createdAt = .now } } @Model final class ProjectTask { var title: String var isComplete: Bool var project: Project? init(title: String) { self.title = title self.isComplete = false } } @main struct MyApp: App { var body: some Scene { WindowGroup("Projects") { ContentView() } .modelContainer(for: [Project.self, ProjectTask.self]) .defaultSize(width: 900, height: 600) #if os(macOS) Settings { SettingsView() } MenuBarExtra("Status", systemImage: "circle.fill") { MenuBarView() } .menuBarExtraStyle(.window) #endif } } struct ContentView: View { @Query(sort: \Project.createdAt, order: .reverse) private var projects: [Project] @Environment(\.modelContext) private var context @State private var selected: Project? var body: some View { NavigationSplitView { List(projects, selection: $selected) { project in NavigationLink(value: project) { Text(project.name) } } .navigationSplitViewColumnWidth(min: 200, ideal: 250) } detail: { if let selected { DetailView(project: selected) } else { ContentUnavailableView("Select a Project", systemImage: "sidebar.left") } } } } ``` ## Scenes & Windows | Scene | Purpose | |-------|---------| | `WindowGroup` | Resizable windows (multiple in
_meta.json
{
"ownerId": "kn76gpsgjw5chv0xvzbzcb8cxn81x46r",
"slug": "swift-macos",
"version": "0.8.4",
"publishedAt": 1791398552530
}references/actors-isolation.md
# Actors & Isolation
## Table of Contents
- Actor Basics
- Global Actors
- @MainActor
- Custom Global Actors
- Nonisolated
- Actor Reentrancy
- Custom Executors (DispatchSerialQueue pattern)
- `assumeIsolated` Recipes
- Reentrancy & Ordering Hazards
- `isolated deinit` (SE-0371)
## Actor Basics
Actors protect mutable state from data races via serialized access:
```swift
actor BankAccount {
let id: UUID
private(set) var balance: Decimal
init(id: UUID, initialBalance: Decimal) {
self.id = id
self.balance = initialBalance
}
func deposit(_ amount: Decimal) {
precondition(amount > 0)
balance += amount
}
func withdraw(_ amount: Decimal) throws {
guard balance >= amount else {
throw BankError.insufficientFunds
}
balance -= amount
}
// Cross-actor operations
func transfer(amount: Decimal, to other: BankAccount) async throws {
try withdraw(amount)
await other.deposit(amount)
}
}
// All access from outside requires await
let account = BankAccount(id: UUID(), initialBalance: 1000)
await account.deposit(500)
let balance = await account.balance
```
### Actor properties
- Actor-isolated properties/methods require `await` from outside
- `let` properties are `nonisolated` by default (immutable = safe)
- Actors are reference types (like classes)
- Actors implicitly conform to `Sendable`
## Global Actors
Annotate types/functions to isolate them to a shared actor:
```swift
@MainActor
class ViewModel {
var items: [Item] = [] // protected by MainActor
func refresh() async throws {
let data = try await api.fetch() // suspends, but resumes on MainActor
items = data
}
}
```
### @MainActor specifics
```swift
// On a function
@MainActor
func updateUI() {
// Guaranteed to run on main thread
}
// On a property
@MainActor var currentTitle: String = ""
// On a closure
let callback: @MainActor () -> Void = {
// Runs on MainActor
}
// Opt out within MainActor type
@MainActor
class ViewModel {
nonisolated var description: String {
"ViewModel" // No actor isolation needed
}
@concurrent
func heavyComputation() async -> Data {
// Runs off MainActor
}
}
```
## Custom Global Actors
```swift
@globalActor
actor DatabaseActor {
static let shared = DatabaseActor()
}
@DatabaseActor
class DatabaseManager {
private var connection: Connection?
func query(_ sql: String) throws -> [Row] {
guard let conn = connection else { throw DBError.notConnected }
return try conn.execute(sql)
}
}
// Usage
@DatabaseActor
func fetchUsers() throws -> [User] {
let rows = try DatabaseManager.shared.query("SELECT * FROM users")
return rows.map(User.init)
}
```
## Nonisolated
Opt specific members out of actor isolation:
```swift
actor Cache {
let name: String // implicitly nonisolated (let)
nonisolated var debugDescription: String {
"references/app-lifecycle.md
# App Lifecycle & Scenes
## Table of Contents
- App Protocol & Entry Point
- WindowGroup
- Window (Single Instance)
- Settings Scene
- MenuBarExtra
- MenuBarExtra Gotchas
- DocumentGroup
- Window Management
- Scene Phases
- Async Termination Cleanup
- LSUIElement Operational Issues
## App Protocol & Entry Point
```swift
@main
struct MyApp: App {
// App-level state
@State private var appState = AppState()
// App delegate for system events
@NSApplicationDelegateAdaptor private var delegate: AppDelegate
var body: some Scene {
WindowGroup("Projects", id: "projects") {
ContentView()
.environment(appState)
}
.defaultSize(width: 1000, height: 700)
.defaultPosition(.center)
.keyboardShortcut("1", modifiers: .command)
Window("Activity", id: "activity") {
ActivityView()
}
.defaultSize(width: 400, height: 600)
.windowResizability(.contentMinSize)
Settings {
SettingsView()
.environment(appState)
}
MenuBarExtra("MyApp", systemImage: "app.fill") {
MenuBarContentView()
}
.menuBarExtraStyle(.window)
}
}
```
## WindowGroup
Creates standard resizable windows. Multiple instances allowed by default:
```swift
// Basic
WindowGroup {
ContentView()
}
// With identifier for programmatic opening
WindowGroup("Editor", id: "editor") {
EditorView()
}
// With data binding - open window for specific item
WindowGroup("Detail", id: "detail", for: Item.ID.self) { $itemID in
if let itemID {
DetailView(itemID: itemID)
}
}
// Open programmatically
@Environment(\.openWindow) private var openWindow
Button("Open Editor") {
openWindow(id: "editor")
}
Button("Show Detail") {
openWindow(value: selectedItem.id)
}
```
Window modifiers:
```swift
WindowGroup {
ContentView()
}
.defaultSize(width: 800, height: 600)
.defaultSize(CGSize(width: 800, height: 600))
.defaultPosition(.center) // .leading, .trailing, .topLeading, etc.
.windowResizability(.automatic) // .contentSize, .contentMinSize
.windowStyle(.automatic) // .hiddenTitleBar, .titleBar
.windowToolbarStyle(.unified) // .unifiedCompact, .expanded, .automatic
.keyboardShortcut("n", modifiers: .command)
```
## Window (Single Instance)
For utility/auxiliary windows that should have only one instance:
```swift
Window("Inspector", id: "inspector") {
InspectorView()
}
.defaultSize(width: 300, height: 500)
.windowResizability(.contentSize)
.commandsRemoved() // Remove default window commands
```
Dismiss from within:
```swift
@Environment(\.dismissWindow) private var dismissWindow
Button("Close") {
dismissWindow(id: "inspector")
}
```
## Settings Scene
Preferences window accessible via Cmd+,:
```swift
Settings {
TabView {
GeneralSettingsView()
.tabItem { Label("General", systemImage: "gear") }
Appearancereferences/appkit-interop.md
# AppKit Interop
## Table of Contents
- NSViewRepresentable
- NSViewControllerRepresentable
- Hosting SwiftUI in AppKit
- Common Bridges
- NSWindow Access
- NSPanel / Floating HUD
## NSViewRepresentable
Wrap an AppKit view for use in SwiftUI:
```swift
struct ColorWellView: NSViewRepresentable {
@Binding var color: Color
func makeNSView(context: Context) -> NSColorWell {
let well = NSColorWell()
well.target = context.coordinator
well.action = #selector(Coordinator.colorChanged(_:))
return well
}
func updateNSView(_ well: NSColorWell, context: Context) {
well.color = NSColor(color)
}
func makeCoordinator() -> Coordinator {
Coordinator(color: $color)
}
class Coordinator: NSObject {
var color: Binding<Color>
init(color: Binding<Color>) {
self.color = color
}
@objc func colorChanged(_ sender: NSColorWell) {
color.wrappedValue = Color(nsColor: sender.color)
}
}
}
```
### Lifecycle methods
```swift
func makeNSView(context: Context) -> NSView // Create (called once)
func updateNSView(_ view: NSView, context: Context) // Update (called on state changes)
static func dismantleNSView(_ view: NSView, coordinator: Coordinator) // Cleanup
// sizeThatFits for intrinsic sizing
func sizeThatFits(_ proposal: ProposedViewSize, nsView: NSView, context: Context) -> CGSize? {
nsView.intrinsicContentSize == .zero ? nil : nsView.intrinsicContentSize
}
```
### Coordinator for delegates
```swift
struct TextViewWrapper: NSViewRepresentable {
@Binding var text: String
func makeNSView(context: Context) -> NSScrollView {
let scrollView = NSTextView.scrollableTextView()
let textView = scrollView.documentView as! NSTextView
textView.delegate = context.coordinator
textView.isEditable = true
textView.font = .monospacedSystemFont(ofSize: 13, weight: .regular)
return scrollView
}
func updateNSView(_ scrollView: NSScrollView, context: Context) {
let textView = scrollView.documentView as! NSTextView
if textView.string != text {
textView.string = text
}
}
func makeCoordinator() -> Coordinator { Coordinator(text: $text) }
class Coordinator: NSObject, NSTextViewDelegate {
var text: Binding<String>
init(text: Binding<String>) { self.text = text }
func textDidChange(_ notification: Notification) {
guard let textView = notification.object as? NSTextView else { return }
text.wrappedValue = textView.string
}
}
}
```
## NSViewControllerRepresentable
Wrap entire AppKit view controllers:
```swift
struct PDFViewWrapper: NSViewControllerRepresentable {
let url: URL
func makeNSViewController(context: Context) -> PDFViewController {
PDFViewController(url: url)
}
func updateNSViewController(_ controller: PDFViewController, conteAionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/tenequm/skills/swift-macos",
"sourceUrl": "https://clawhub.ai/tenequm/skills/swift-macos",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-09T22:17:53.681Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-tenequm-swift-macos/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-tenequm-swift-macos/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-09T22:17:53.681Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.9K downloads",
"href": "https://clawhub.ai/tenequm/swift-macos",
"sourceUrl": "https://clawhub.ai/tenequm/swift-macos",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-09T22:17:53.681Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "0.8.4",
"href": "https://clawhub.ai/tenequm/swift-macos",
"sourceUrl": "https://clawhub.ai/tenequm/swift-macos",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-10-07T18:42:32.530Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-tenequm-swift-macos/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-tenequm-swift-macos/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 0.8.4",
"description": "Updated swift-macos from 0.8.3 to 0.8.4. Changes: - modified `CHANGELOG.md` - modified `SKILL.md` - modified `references/app-lifecycle.md`",
"href": "https://clawhub.ai/tenequm/swift-macos",
"sourceUrl": "https://clawhub.ai/tenequm/swift-macos",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-10-07T18:42:32.530Z",
"isPublic": true
}
]
}Record generated Oct 10, 2026.
