It gives errors when using Swift Static library with Objective-C project It gives errors when using Swift Static library with Objective-C project ios ios

It gives errors when using Swift Static library with Objective-C project


I've got the same error on my demo project when added first Swift file in my pod compiled as static library. For me solution was simple - just added empty Swift file to my demo project which was previously in Objective-C only. This solved all linker errors.


An update to Alex's answer:

In my case it was a React-Native project after adding a Swift Pods library. Maybe just the step 2 can work:

  1. Adding a new Swift file and a Brigde header:

1) File -> New -> File<code>File -> New -> File</code>

2) Select Swift File Select <code>Swift File</code>

3) Confirm Create Bridging Header enter image description here

  1. Go to Build Settings and set Always Embed Swift Standard Libraries to YES Always Embed Swift Standard Libraries


This answer worked for me: Add $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) to the library search paths.