# What are Opaque Types?

**URL:** <https://forums.swift.org/t/what-are-opaque-types/69296>\
**Category:** Using Swift\
**Tags:** opaque-types\
**Created:** [January 6, 2024, 4:48am UTC](https://forums.swift.org/t/what-are-opaque-types/69296 "2024-01-06T04:48:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kobe24](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kobe24/32/32556_2.png) [@Kobe24](https://forums.swift.org/u/Kobe24)\
**Post date:** [January 6, 2024, 4:48am UTC](https://forums.swift.org/t/what-are-opaque-types/69296/1 "2024-01-06T04:48:57Z")

</div>

Hello, my name is Kobe, and I am studying Swift and iOS in South Korea.

Recently, I came across the keyword `some` for the first time, and as I researched it, I found the following explanation:

"In the Swift language, the `some` keyword is primarily used to represent Opaque Types."

The part that I'm having trouble understanding is exactly what `Opaque Types` are.

What type of types are `Opaque Types`?

---

<div class="post-metadata">

**Author:** ![xwu](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@xwu](https://forums.swift.org/u/xwu)\
**Post date:** [January 6, 2024, 4:55am UTC](https://forums.swift.org/t/what-are-opaque-types/69296/2 "2024-01-06T04:55:48Z")

</div>

This is a good question. There are a number of ways in which opaque types have been explained, but I think an excellent starting point is found in the [relevant chapter](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/opaquetypes/) in recent versions of _The Swift Programming Language_:

> A function or method that returns an opaque type hides its return value’s type information. Instead of providing a concrete type as the function’s return type, the return value is described in terms of the protocols it supports. Opaque types preserve type identity — the compiler has access to the type information, but clients of the module don’t.

See if the first part of that chapter (the sections before you get to "boxed" or existential types) makes some sense. I or others can clarify or point you to further resources depending on what questions arise.

---

<div class="post-metadata">

**Author:** ![Kobe24](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kobe24/32/32556_2.png) [@Kobe24](https://forums.swift.org/u/Kobe24)\
**Post date:** [January 6, 2024, 5:01am UTC](https://forums.swift.org/t/what-are-opaque-types/69296/3 "2024-01-06T05:01:36Z")

</div>

Dear Xiaodi Wu, 😄

Thank you sincerely for taking the time to read my question and providing an answer. I am truly grateful for your help, as it has greatly enhanced my knowledge.

Have a wonderful day 🥰
