use package access modifier binary framework
Asked on 08/11/2024
1 search
In Swift, access control is an important feature that helps manage the visibility and accessibility of code components across different modules and packages. The access levels in Swift include private
, internal
, package
, and public
.
- Private: Accessible only within the same file.
- Internal: Accessible within the same module.
- Package: Accessible from other modules in the same package.
- Public: Accessible from any other module.
When you don't specify an access level, Swift implicitly uses internal
. The package
access level is particularly useful when you want to share code between modules within the same package but not expose it to external modules. This is especially relevant when working with binary frameworks, as it allows for a more controlled exposure of APIs.
For more details on Swift's access control and package management, you can refer to the session A Swift Tour: Explore Swift’s features and design (10:59).

What’s new in privacy
At Apple, we believe privacy is a fundamental human right. Learn about new and improved permission flows and other features that manage data in a privacy-preserving way, so that you can focus on creating great app experiences.

A Swift Tour: Explore Swift’s features and design
Learn the essential features and design philosophy of the Swift programming language. We’ll explore how to model data, handle errors, use protocols, write concurrent code, and more while building up a Swift package that has a library, an HTTP server, and a command line client. Whether you’re just beginning your Swift journey or have been with us from the start, this talk will help you get the most out of the language.

Migrate your app to Swift 6
Experience Swift 6 migration in action as we update an existing sample app. Learn how to migrate incrementally, module by module, and how the compiler helps you identify code that’s at risk of data races. Discover different techniques for ensuring clear isolation boundaries and eliminating concurrent access to shared mutable state.