smithery/neversight

swift_structure

Swift language structures including collections, optionals, closures, generics, control flow, and core language features.

Installation

$ npx skills add smithery/neversight --skill swift-structure

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/neversight · top by installs.

npx skills add smithery/neversight

Browse all from smithery/neversight

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.0
LicenseProprietary
CompatibilityAll Swift versions
More metadata
version
1.0
author
SwiftZilla
website
https://swiftzilla.dev

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,052 B
  • docs SUMMARY.md 144 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Swift Structure

This skill covers Swift's core language structures and features for building robust applications.

Overview

Swift structure skills cover the fundamental building blocks of the language: collections, optionals, control flow, closures, and other essential language features.

Available References

Collections

  • [Array](./references/collections_array.md) - Ordered collections, map/filter/reduce operations
  • [Dictionary](./references/collections_dictionary.md) - Key-value pairs, lookups, transformations
  • [Set](./references/collections_set.md) - Unique elements, set algebra operations

Language Features

  • [Optionals](./references/optionals.md) - Optional binding, unwrapping, nil handling
  • [Closures](./references/closures.md) - Closure expressions, trailing closure syntax
  • [Generics](./references/generics.md) - Generic types, constraints, associated types
  • [Extensions](./references/extensions.md) - Type extensions, computed properties
  • [Control Flow](./references/control_flow.md) - Conditionals, loops, pattern matching
  • [Error Handling](./references/error_handling.md) - Throws, do-catch, Result type

Data Types

  • [Strings](./references/strings.md) - String manipulation, interpolation, Unicode

Quick Reference

Collections Comparison

Collection Order Duplicates Use When
Array Ordered Allowed Indexed access needed
Dictionary Unordered Keys unique Key-based lookup
Set Unordered Not allowed Uniqueness required

Optional Handling

// Optional binding
if let value = optional { }
guard let value = optional else { return }

// Nil coalescing
let value = optional ?? defaultValue

// Optional chaining
let result = object?.property?.method()

Common Higher-Order Functions

array.map { $0 * 2 }           // Transform
array.filter { $0 > 0 }         // Select
array.reduce(0, +)              // Combine
array.compactMap { Int($0) }    // Transform + remove nil
array.flatMap { $0 }            // Flatten

Best Practices

  1. Use appropriate collection - Match collection to use case
  2. Handle optionals safely - Never force unwrap without certainty
  3. Leverage higher-order functions - Cleaner functional code
  4. Use extensions for organization - Group related functionality
  5. Prefer generics for reusability - Type-safe flexible code
  6. Make switch exhaustive - Handle all cases
  7. Use do-catch properly - Handle errors appropriately

For More Information

Each reference file contains detailed information, code examples, and best practices for specific topics. Visit https://swiftzilla.dev for comprehensive Swift documentation.