Swift 5.6: Opaque Return Types. Part 1

Andreea Andro
2 min readJul 5, 2022

A function or method with an opaque return type hides its return value’s type information.
- the return value is described in terms of the protocols it supports
- useful at boundaries between a module and code that calls into the module, because the underlying type of the return value can remain private
- is different then returning a protocol type: opaque types preserve type identity — the compiler has access to the type information, but clients of the module don’t.

Opaque Return…

--

--