Problem Statement
Explain how generics and protocol constraints work together in Swift and provide an example.
Explanation
Generics in Swift let you write code that works with any type, but sometimes you need to restrict those types to those that meet certain requirements (protocol constraints). For example `func sort<T: Comparable>(_ array: [T]) -> [T]` means T must conform to Comparable. /n/n Protocol constraints combine generics and protocols: you define a generic placeholder T that must conform to a protocol (or multiple protocols) and then you can call methods or access properties required by the protocol on T. /n/n An example: `func makeCollection<C: Collection>(_ c: C) -> Int { return c.count }` Here `C` must conform to `Collection` so you know `.count` exists. This combination increases code reuse while preserving type safety.