Sort Descriptors
summary
Shows how to replace Foundation’s runtime NSSortDescriptor style key‑value sorting with pure Swift: defines a generic sort‑descriptor typealias (A -> A -> Bool), uses localizedCaseInsensitiveCompare for strings, composes multiple descriptors into one comparator so last‑name then first‑name ordering works, and provides a lift optionals helper plus a Comparable‑based generator for numeric fields like year of birth. Result is fully type‑safe, works with structs and avoids KVC/NSObject.
AI-written summary · about
