Don't use Bundle(for: MyClass.self), I experienced a bug, you might get application’s version number.
ChatGPT:
If there are multiple classes named MyClass
(for instance,
one in your app and one in your framework), then the outcome would
depend on which MyClass
class is being referenced at runtime.
I fixed it by just hard coding version number.
Use below code instead (Suggested by Bing Chat and Bard) or just hard code version number.
let frameworkBundle = Bundle(identifier: "com.example.framework")
let frameworkVersion = frameworkBundle?.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
// or
let frameworkVersion = "1.0"