What problem does it solve?
This Skill solves the problem of unsafe, heap-allocated memory access in Swift performance-critical code, eliminating the need for error-prone UnsafePointer types while reducing runtime overhead from copy-on-write and reference counting.
Core Features & Use Cases
- Fixed-Size Stack Storage: Use InlineArray for compile-time sized collections stored inline with no heap allocation or reference counting, ideal for small fixed data like color components or matrix rows.
- Safe Contiguous Memory Access: Use the Span family (Span, MutableSpan, RawSpan, UTF8Span) for zero-cost, compiler-checked access to contiguous memory instead of legacy unsafe pointers.
- Use Case: Optimize hot paths like binary parsing, signal processing, or embedded Swift code where heap allocation overhead and unsafe pointer errors are unacceptable.
Quick Start
Use the memory skill to replace your existing UnsafeBufferPointer usage in the audio buffer processing function with a safe Span implementation.