I'm using a 3rd party library provided as a framework : Library.framework. Apparently, it can only be used in my Swift
project via the Bridging Header by doing #import <Library/Library.h>
. Which is fine in most cases.
However, I'm currently developing a Pod in which I want to use Library.framework. This means that I cannot rely on the Bridging Header.
I tried to link the Library.framework in my Pod target (see General > Linked Frameworks and Libraries
) but then, once the Pod is installed in my app, Xcode says the Pod cannot compile because some files in Library are not found.
What would be the best strategy to adopt here ?
I think I made it.
The trick was to add the .h files in both source_files
and public_header_files
in the Pod.podspec.
Like this :
s.source_files = 'Library.framework/Headers/*.h'
s.public_header_files = 'Library.framework/Headers/*.h'
This way, all the header files appear in the Pod-umbrella.h
and can now be used in my app.
In your pod project I assume you have a file named [PodName].h, it will look similar to the file below. You could try to add the header in this file.
//
// PodName.h
// PodName
//
// Created by John Doe on 06.04.2016.
// Copyright © 2016 John Doe Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for PodName.
FOUNDATION_EXPORT double PodNameVersionNumber;
//! Project version string for PodName.
FOUNDATION_EXPORT const unsigned char PodNameVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <PodName/PublicHeader.h>
#import <Library/Library.h> // Add framework header here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With