https://docs.swift.org/swift-book/documentation/the-swift-programming-language/opaquetypes/#Differences-Between-Opaque-Types-and-Protocol-Types

The Problem That Opaque Types Solve


Returning an Opaque Type


generic 에서 caller 의 역할

func max<T>(_ x: T, _ y: T) -> T where T: Comparable { ... }
  1. caller 가 전달한 x 와 y 의 값이 T 의 concrete type 을 결정한다.

    concrete type? → type(of:)

  2. caller 는 Comparable 을 채택한 타입들만 사용할 수 있다. (constraint)

  3. The implementation of max(_:_:) uses only functionality that all Comparable types share.

opaque return type 의 역할