swift-memory

Provide fixed-size storage and safe zero-copy memory views for Swift.

4|1|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/AutisticAF/claude-code-apple-dev-plugin --skill swift-memory-autisticaf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-memory
Source: https://github.com/AutisticAF/claude-code-apple-dev-plugin/tree/main/skills/swift-memory
Command: npx skills add https://github.com/AutisticAF/claude-code-apple-dev-plugin --skill swift-memory-autisticaf

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Swift memory management often relies on heap-allocated collections and unsafe pointers, which introduce overhead and potential safety risks in performance-critical code. swift-memory provides InlineArray and Span types to offer fixed-size storage and safe, zero-cost memory access.

Core Features & Use Cases

  • InlineArray for fixed-size storage with no heap allocation
  • Span and MutableSpan for safe, contiguous memory access without escaping lifetimes
  • Use cases include binary parsing, high-performance data processing, and embedded Swift

Quick Start

Instantiate an InlineArray<4, Int> and begin using Span-based views to access fixed-size storage safely.

Frequently Asked Questions about swift-memory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I avoid heap allocations for fixed-size arrays in Swift?

Use swift-memory's InlineArray type to allocate fixed-size storage inline without heap allocations. This prevents memory-management overhead in performance-critical Swift paths.

How does zero-copy memory access work for binary parsing in Swift?

Zero-copy memory access uses Span and MutableSpan types to provide safe, contiguous views over data without escaping lifetimes. These enable efficient binary parsing without unsafe pointers.

Do I need Swift 6.2 to use Span and InlineArray for memory access?

Yes, swift-memory requires Swift 6.2 to utilize InlineArray, Span, MutableSpan, RawSpan, and UTF8Span. These types enforce compile-time sizes and safe memory access.

What's the best way to handle contiguous memory safely in embedded Swift?

Use swift-memory's Span-based views and InlineArray for fixed-size storage in embedded Swift. This approach eliminates heap allocations and unsafe pointers while enforcing compile-time sizes.

When should I use InlineArray instead of standard Swift collections?

Use InlineArray for performance-critical paths like binary parsing, graphics, and embedded Swift where heap allocations and unsafe pointers are undesirable. It provides fixed-size storage with zero-overhead memory access.