Closed lozflan closed 5 years ago
I have personally never worked with frameworks; however, from what I've seen with code that I've read while working with Frameworks you need to declare the correct Access Control
for some code to be available for the rest of the codebase. I think adding the public
modifier to the extensions might help that extension propagate down the other projects if you have imported it.
Hi serjooo, thx for your reply. I haven't been able to solve this. I tried that previously and adding the public modifier to the extensions in the framework doesn't work. It gives compiler error "'public' modifier cannot be used with extensions that declare protocol conformances".
Oh yes Swift doesn't allow that.. Did you attempt at creating a class that satisfies both requirements and declare it public so that you can use it. For example:
public class FirestoreGeopoint: GeoPoint, GeoPointType {
required override public init(latitude: Double, longitude: Double) {
super.init(latitude: latitude, longitude: longitude)
}
}
I know its extra work, but I'm not sure how else this could be solved personally.
@lozflan any updates on this?
Sorry. Been sidetracked. I’ll try your suggestion this weekend
@lozflan closing this as thread has gone stale
Im using CodableFirebase with Firebase Firestore. Im using FieldValue and Timestamps so I've added the required following extension lines to my code.
extension DocumentReference: DocumentReferenceType {} extension GeoPoint: GeoPointType {} extension FieldValue: FieldValueType {} extension Timestamp: TimestampType {}
I have a simple IDRequest struct and a simple IDRequestStatus enum with associated values which conform to Codable. Everything works fine if the code for these 2 objects and the above extensions are contained within my app ie i can code and decode the objects successfully.
My app structure however is 2 related apps using a common custom framework so I want the code for the above objects to reside in the framework. If I move the code for the 2 above objects and the extensions from the app to the framework instead, CodableFirebase doesn't work and I get error:typeIsNotSupported error. I am only using FieldValue and Timestamp types in my code (not DocumentReference and GeoPoint).
Is CodableFirebase not compatible with use in custom frameworks?. Any help appreciated.