Clarification on adding Objective C code to a swift dynamic framework

I have a dynamic framework in swift that currently is linking in another framework that is written in Objective C. This works but its annoying because the Objective C framework really only 2 files and I was wondering if there is a way to bring this into my swift framework.

If this was an application I’d user Bridging-Header but that is not supported inside a swift framework.

  • Calling a method from another class in Objective C
  • Default UISwitch to YES then save state with NSUserDefaults
  • How to find a Clang warning flag in Xcode that's not present in build logs
  • XMPP chat app got rejected for using VoIP service as background mode
  • How can I read a large UTF-8 file on an iPhone?
  • How UIView animations with blocks work under the hood
  • My framework is called GDL90 and consists of only swift files.

    My Objective-C framework consists of:

    • GeoidCalculator.h
    • GeoidCalculator.m
    • EGM96 (data file)
    • CORCOEF(data file)

    Real simple – right? So I wanted to see if there was a way to just add this code into my swift project.

    Attempt #1 – add my code into the “umbrella header?” GDL90.h

    I added my file an get the warning Include of non-modular header inside framework module ‘GDL90’

    Ok so thats no dice.

    Attempt 2

    I figured I needed to make a module map file.

    So I made a directory called ${SRCROOT}/GDL90/EGM96 and inside I created EGM96.module.modulemap

    module EGM96 {
        header "GeoidCalculator.h"
        export *

    And then in one of my swift files i have import EGM96 which doesn’t seem to be found.

    In my build settings i have:

    Define Modules turned on and I’m pointing to the modulemap file from my Module Map File item

    Am I missing something??

    Solutions Collect From Internet About “Clarification on adding Objective C code to a swift dynamic framework”

    You do not need the modulemap files if create internal framework correctly:

    1. Create new framework target “EGM96” under EGM96 project:
      • go to GDL90 Project -> Add New Target -> Cocoa Touch Framework
      • input the Name and select Objective-C as language
        enter image description here
    2. Add objective-с files and other sources of EGM96 to new target.
      enter image description here

    3. Add GeoidCalculator.h as public header:

      • Change target membership of GeoidCalculator.h header from “Project” to “Public”
        enter image description here
      • Import headers to the umbrella file called EGM96.h
      • Make sure umbrella header EGM96.h is public for EGM96 target.
        enter image description here
    4. Add new framework to target dependence of GDL90 and add new library to linked binaries of GDL90.
      enter image description here
    5. Now you can import EGM96 in any swift file of EGM96:

    import EGM96