[swift-users] Discrepancy between sharing internal Swift symbols with Obj-C when in an app vs a framework target

Kevin Lundberg kevin at klundberg.com
Fri Jun 3 21:55:57 CDT 2016

I ran into a major hurdle this week that basically stopped my work in
its tracks. I've been working on moving a large codebase from an iOS app
target to a framework target, since we have the same code in multiple
app targets and it is problematic to have to remember to add new code to
every single app target when they can all just share a framework.

However I didn't anticipate the issue that made this task explode in
terms of effort. According to the Using Swift with Cocoa & obj-C book
(this section:
swift code in an app target can be accessed from obj-c if it is internal
or public. However, swift code in a framework target can only be
accessed from objc if it is public, not internal.

Is there any way around this restriction? The codebase I want to migrate
has a lot of swift and obj-c intermingling, and I can't see a reasonable
end to converting everything I need to convert to public from internal
for this to work.

If there's no feasible workaround, would swift-evolution be the proper
place to discuss changing this behavior? Or is this something that would
need to be logged in radar for the Xcode team to address?

- Kevin

More information about the swift-users mailing list