Include .h file from a pod into a different pod in the same xcworkspace

74 Views Asked by At

I have two pods in my project : One, is YapDatabase for key-value storage.
Two, is APAddressBook to deal with phonebook.

I want to extract phonebook contacts as APContact objects then store them in YapDatabase.
The Problem is YapDatabase wants the object to save to be serialised using its own way (Being a subclass).
I want to modify my APContact to be a subclass of YapDatabaseObject but they are in two different pods.


How, can i import OTRYapDatabaseObject.h into APContact without the error "OTRYapDatabaseObject.h" file not found ?

Thanks

1

There are 1 best solutions below

0
On

The YapDatabase project does not enforce a base class. That is, there is no such thing as YapDatabaseObject, at least in the sense that it is not a part of the official API.

The only requirements that YapDatabase itself enforces, is that the configured serializer & deserializer are able to convert your object to & from data blobs.

The wiki article "Storing Objects" has more information on this: https://github.com/yapstudios/YapDatabase/wiki/Storing-Objects

But the gist is that YapDatabase has a configurable serializer & deserializer, and you can customize them to fit your needs.

typedef NSData* (^YapDatabaseSerializer)(NSString *collection, NSString *key, id object);
typedef id (^YapDatabaseDeserializer)(NSString *collection, NSString *key, NSData *data);

I want to extract phonebook contacts as APContact objects then store them in YapDatabase

It looks like APContact is a pretty basic NSObject, consisting of only public properties. So to achieve your goal, all you really need is code (within your project) that can perform the serialization & deserialization of APContact objects. And then tweak YapDatabase's serializer & deserializer to use your custom APContact serialization & deserialization when appropriate.