title: Associated Types in Swift
body: <p>What are associated types in swift programming language? What are they used for?</p>
  
  <p>As per swift programming language book:</p>
  
  <blockquote>
    <p>When defining a protocol, <strong>it is sometimes useful</strong> to declare one or
    more associated types as part of the protocol’s definition. An
    associated type gives a placeholder name (or alias) to a type that is
    used as part of the protocol. The actual type to use for that
    associated type is not specified until the protocol is adopted.
    Associated types are specified with the typealias keyword.</p>
  </blockquote>
  
  <p>The above text is not very clear to me. It would help a lot if you can explain associated types with an example.</p>
  
  <p>Also, why is it useful to declare an associated type as part of a protocol definition?</p>