swift-book
swift-book copied to clipboard
Access Control — Mention macros in the intro
Location
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/accesscontrol
Description
This subsection doesn't reflect the changes to Swift with respect to macros and packages.
Correction
Reword the first sentence in the first paragraph to: Access control restricts access to parts of your code from code in other types, source files, modules and packages. Add the following sentence to the end of the second paragraph: However, both macro declarations and their associated implementation types must have public access since the code that declares a macro is in a different module than that that implements it.
This appears to already be covered in the Macros chapter, which is the appropriate place for this detail anyhow.
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/macros#Macro-Declarations
Macros are always declared as
public
. Because the code that declares a macro is in a different module from code that uses that macro, there isn’t anywhere you could apply a nonpublic macro.