# Namespacing protocols to other types

**URL:** <https://forums.swift.org/t/namespacing-protocols-to-other-types/7328>\
**Category:** Discussion\
**Created:** [December 25, 2017, 2:53am UTC](https://forums.swift.org/t/namespacing-protocols-to-other-types/7328 "2017-12-25T02:53:33Z")\
**Posts on this page:** 1\
**Showing post:** 54

<div class="post-metadata">

**Author:** ![Karl](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@Karl](https://forums.swift.org/u/Karl)\
**Post date:** [February 2, 2021, 5:49pm UTC](https://forums.swift.org/t/namespacing-protocols-to-other-types/7328/54 "2021-02-02T17:49:21Z")

</div>

Currently the best hack to allow nesting protocols inside of other types is to use a typealias. So given the common `MyView.Delegate` use-case, you could write something like:

```swift
protocol _MyViewDelegate: AnyObject {
}

struct MyView {
  typealias Delegate = _MyViewDelegate
}

class SomeDelegate: MyView.Delegate { // works!
}

```

But yeah, it would be _a lot_ nicer if we could write that the way we write other nested types. I also still really want nested types in protocols.

---

_[View the full topic](https://forums.swift.org/t/namespacing-protocols-to-other-types/7328)._
