Mixing Swift and Objective-C cocoapods
I recently ran into a cocoapods issue after I added a pod written in swift to a project that also uses objective-c pods. Adding the swift dependency required adding use_frameworks! to the Podfile. One of the objective-c pods had a dependency that freaked out once that change was made:
SnowplowTracker (an event tracker) uses FMDB (an Objective-C wrapper around SQLite), which makes use of non-modular header includes (#import "sqlite3.h" as opposed to #import <sqlite3.h>). Within frameworks this is incorrect. Cocoapods allowed it until a recent change was made.
Xcode complained with the following errors:

and

Until the authors of theFMDB pod resolve the issue, a workaround is needed. The Podfile can be configured to fall back to the previous behavior, once again allowing non-modular includes in framework modules:
post_install do |installer|
installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
end
endThis sets a compiler flag for each pod which allows the non-modular includes in framework modules. The flag can also be added manually for each pod in the project file.
The project will now build. Unless you try to import any header files that use the incorrect import-style into the bridging header or into any other objective-c header or source file. To let Xcode know where to look for those headers, add the header location to the project’s Header Search Paths in the project file under Build Settings:

For a relative path to the Pods/ directory use the prefix ${PODS_ROOT}/. SnowplowTracker (version 0.6.2) uses incorrect headers. For Xcode to find all relevant SnowplowTracker headers, add:
"${PODS_ROOT}/SnowplowTracker/Snowplow"including quotes. For SnowplowTracker the following will now compile:

In case it doesn’t (our CI environment didn’t like this), add an entry for Import Paths (instead of Header Search Paths):
