Reputation: 1
I have a public function using a public protocol as the type of its parameter and I got the error method must be declared internal because its parameter uses an internal type
. The function and the protocol are in different Swift packages(targets) under same project.
Function in Swift package A:
import B
public func func1(routeDelegate: RouteDelegate)
protocol in Swift package B:
public protocol RouteDelegate {
func route(routeTerm: String?) -> String
}
I have added these 2 packages as each other's dependency in Package
I've been stuck here for a few hours. Any idea why the public protocol would be recognized as an internal type for parameter? Thanks!
Update: I tried to move both function and protocol in to same Swift package, and I no longer get the error. So it seems to me that while protocol is marked public, accessing it from same Swift package still makes it public, but accessing it from another Swift package would change it to be internal. Why?
Upvotes: 0
Views: 1079