We have some code that we share between a private framework (used by our app and its app extensions) and a public SDK that we distribute to external partners. We'd like to specify access control to certain data structures depending on which target is specified (e.g. public
for our private framework, and internal
for our distributed SDK). At a cursory glance, it seems like the only way to properly do this is with a fair amount of duplication:
#if SDK_TARGET
internal struct Foo {
var bar: String?
}
#else
public struct Foo {
var bar: String?
}
#endif
This clearly does not scale with larger data structures. Are there any better strategies we can adopt here?