How to restrict static lib classes access to framework users

I have objective c static library and I have used it inside the swift framework but when I distribute swift framework to users they are able to access my static library classes directly. so how would I stop the direct access of static lib classes to framework users?

moduleMap file code - ProjectName.modulemap

framework module {
umbrella header "ProjectName.h"
export *
module * { export * }

explicit module ProjectName_Private {
    private header “<headerName>.h”

    link “staticLibName” // external static Library 
    export *


Build settings

  1. Set header search path - ${SRCROOT}/
  2. Set library search path - (inherited) (PROJECT_DIR)/
  3. Module map file - /
  4. Import path - (inherited) (PROJECT_DIR)/
  5. Build Library for distribution - yes

It isn’t officially possible yet because the design isn’t finalized, but you can try out @_implementationOnly at your own risk. Here is an example in SwiftSyntax’ source code.

thanks for the reply, will try to implement.

Terms of Service

Privacy Policy

Cookie Policy