# Calling private methods from extensions in separate files

**URL:** <https://forums.swift.org/t/calling-private-methods-from-extensions-in-separate-files/54029>\
**Category:** Discussion\
**Created:** [December 13, 2021, 6:16pm UTC](https://forums.swift.org/t/calling-private-methods-from-extensions-in-separate-files/54029 "2021-12-13T18:16:25Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![Lantua](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lantua/32/8868_2.png) [@Lantua](https://forums.swift.org/u/Lantua)\
**Post date:** [December 14, 2021, 2:57am UTC](https://forums.swift.org/t/calling-private-methods-from-extensions-in-separate-files/54029/17 "2021-12-14T02:57:44Z")

</div>

IME, Swift's access control\* is such a delight to use that the old type-based system feels ancient no matter what languages I switched to. I can't quite put it into words, but Becca's word strongly resonate with me:

> [@Implement Alvarez & Monteiro's "typeprivate", possibly with one or two extra restrictions](https://forums.swift.org/t/implement-alvarez-monteiros-typeprivate-possibly-with-one-or-two-extra-restrictions/40994/13):
>
> It is the very arbitrary-ness of a file that makes it such a good way to define an access control boundary. The problem with something like typeprivate is that, if the enclosing type doesn’t quite encompass the code that ought to have access to the declaration, you either need to move declarations into/out of the type to grant/restrict access, or you need to abandon typeprivate. If you do the former, you’re contorting the design of your types to fit into the access control system, which can ha…

\* No, not you `private`. You're stealing `fileprivate`'s place again... 😑

* * *

Digression aside, I'm not sure I ever have a problem with one part of the project accessing other parts because of them being `internal`. I do get somewhat paranoid in the beginning, but nothing ever comes out of it, even as the projects grow in size.

Though all these talks about _security_ and _trust_ make me think I might be missing out on some fun people are having. I mean, access control is such an easy thing to bypass that they're usually more about convenience than concerns.

---

_[View the full topic](https://forums.swift.org/t/calling-private-methods-from-extensions-in-separate-files/54029)._
