Linking Objective-C Libraries to Swift Frameworks

Today I have faced issue to adding Objective-C Libraries to Swift Frameworks.
I found many tutorials but only one of them really helped me. I will provide link to original post below on the end of the current post.

  1. First we have to create modulemap.map file that lists all of the header files part of the library.
    In my case I need to add Header of TryCatchHandler.h. So I created folder TryCatchHandler and put modulemap.map to it
  2. We have two ways how to add headers to file
    1. Add all headers you need directly to this file as below:
      module TryCatchHandler {
          header "TryCatchHandler.h"
          header "TryCatchHandler1.h"
          header "TryCatchHandler2.h"
      }
    2. Create ambrella header file, you can name it like you want, for instance TryCatchHandlerFramework.h
      1. Put down all headers you need to ambrella framework: #import "MyHeader1.h"
        #import "TryCatchHandler.h"
        #import "TryCatchHandler1.h"
        #import "TryCatchHandler2.h"
      2. Add ambrella header to modulemap.map
        module TryCatchHandler {
            umbrella header "TryCatchHandlerFramework.h"
            export *
        }
      3. The export * implies that all imported headers in the umbrella header to be part of the module.

    3. Finally you need to place this newly created module map in the same directory as the header files

      1. Once you have the module map in place, you need to update a few build settings

      2. Link the library to the appropriate target (app or framework). Complete this by dragging the binary library file into Linked Frameworks and Libraries section under the general tab in build settings

      3. With your target selected, under build settings, add the Library path to the following

        1. Import Paths

        2. Header Search Paths

        3. Library Search Paths

    4. In original port there is step to add the module map file location to Private Module Map File

      BUT THIS STEP DOES NOT WORK FOR ME, 
      if I complete this step I have error: Redefinition of module TryCatchHendler

      I left Private Module Map File empty

The original articl you can find here

Enjoy!