Install
openclaw skills install swiftWrite safe Swift code avoiding memory leaks, optional traps, and concurrency bugs.
openclaw skills install swift| Topic | File |
|---|---|
| Optionals, nil safety, force unwrap | optionals.md |
| Retain cycles, weak refs, closures | memory.md |
| async/await, actors, Sendable, value types | concurrency.md |
| JSON encoding/decoding traps | codable.md |
| Protocols, collections, strings, errors, build | types.md |
| SwiftUI state (@State, @Binding, Combine) | swiftui.md |
| Property wrappers, actors, result builders, macros | advanced.md |
| XCTest pitfalls, SPM gotchas | testing.md |
! crashes on nil — use guard let or if let insteadself strongly create retain cycles — use [weak self] in escaping closuresweak — strong delegate = object never deallocatestry! crashes on any error — never use in production pathsremoveFirst() crashes on empty — use popFirst() for safetyasync let starts immediately — not when you awaitawait — state may change between suspension points@MainActor doesn't guarantee immediate main thread — it's queuedSendable conformance violations crash at runtime — compiler warnings are errorsarray[0].mutate() doesn't workString.Index from one string invalid on another — even if contents match@StateObject owns, @ObservedObject borrows — recreating view loses ObservedObject state@EnvironmentObject crashes if not injected — no compile-time check@State — changing ID loses stateprint() builds strings even in release — remove or use os_log