firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.66k stars 1.49k forks source link

[Core] Add ability to load version from product SDK #13639

Closed ncooke3 closed 1 month ago

ncooke3 commented 1 month ago

This PR adds support for SDKs outside of the firebase-ios-sdk repo to register with core. Like how the Swift SDKs inside of the firebase-ios-sdk repo are registered, it relies on hardcoding information about the SDK in core.

To support SDKs that may have a version different from core, they have the option of implementing the func sdkVersion() -> String method.

For example, the below code belongs to the Foo package that lives outside of the firebease-ios-sdk repo. If the below code is included in the Foo SDK, and the client depends on both Foo and the firebase-ios-sdk packages, Foo will register itself with core.

// Foo.swift
// Inside of the `Foo` package

@objc(FIRFooComponent) class FirebaseFooComponent: NSObject {
  @objc static func sdkVersion() -> String {
    return "12.0.0" 
  }
}
google-oss-bot commented 1 month ago
1 Warning
:warning: Did you forget to add a changelog entry? (Add #no-changelog to the PR description to silence this warning.)

Generated by :no_entry_sign: Danger