Prompt Refactor

Improve Swift Generics

Refactor repetitive code into generic types with proper constraints and associated types.

swift
Insert label Generics
Prompt

Find duplicated code that varies only by type and refactor it into generics. Add protocol constraints (where clauses) to keep generics safe. Use associated types in protocols where the conforming type determines the concrete type. Prefer some/any opaque types over raw generics in public APIs where appropriate.

Add this to your Facet Inserts in Crystl for one-click access.

Get Crystl