I'm creating a minimal XCFramework that wraps Firestore operations, but keep encountering build errors related to Firebase's library evolution support. The goal is to create a drag-and-drop .xcframework that can be used in other projects without exposing Firebase details.
It will be nicer if after setup You give simpler example having a xcframework like Firestore manager in which there is this basic function of saveData simplest and in host project this is used like (as i want to seee how to integrate also)
Firstly I just use import firebasefirestore in xcframework it says error ,
then i used internal import firebasefirestore but then it is saying firebase is configure in host app but not in xc framework.
errors -->
te: Disabling previews because SWIFT_VERSION is set and SWIFT_OPTIMIZATION_LEVEL=-Owholemodule, expected -Onone (in target 'grpcWrapper' from project 'gRPC')
note: Disabling previews because SWIFT_VERSION is set and SWIFT_OPTIMIZATION_LEVEL=-O, expected -Onone (in target 'FirestoreHelper' from project 'FirestoreHelper')
** ARCHIVE FAILED **
The following build commands failed:
SwiftVerifyEmittedModuleInterface normal arm64 Verifying\ emitted\ module\ interface\ FirebaseFirestore.swiftinterface
This is my simple code for xcframework which i want to use in host app
import Foundation
internal import FirebaseCore
internal import FirebaseFirestore
public class FirestoreManager {
private var db: Firestore
public init() {
guard FirebaseApp.app() != nil else {
fatalError("Firebase not configured. Call FirebaseApp.configure() in the host app's AppDelegate.")
}
self.db = Firestore.firestore()
}
public func saveData(
collection: String,
documentID: String,
data: [String: Any],
completion: @escaping (Error?) -> Void
) {
db.collection(collection).document(documentID).setData(data, completion: completion)
}
}