memory
Installation
SKILL.md
InlineArray and Span
Guidance for Swift 6.2's low-level memory types: InlineArray for fixed-size inline storage without heap allocation, and Span for safe, zero-cost access to contiguous memory. These replace common uses of UnsafeBufferPointer and hand-tuned tuple storage with compiler-checked alternatives.
When This Skill Activates
Use this skill when the user:
- Asks about InlineArray, fixed-size arrays, or stack-allocated collections
- Mentions Span, MutableSpan, RawSpan, or UTF8Span
- Wants to eliminate heap allocations in hot paths
- Is replacing UnsafeBufferPointer or UnsafePointer with safe alternatives
- Asks about value generics or
let count: Intgeneric parameters - Needs zero-copy access to collection storage
- Mentions inline storage, contiguous memory, or memory layout
- Is doing binary parsing, signal processing, or embedded Swift work
- Wants to avoid copy-on-write overhead for small fixed collections
- Asks about non-escapable types or lifetime dependencies in Swift