-3

How do you show the build version with the scheme in the application?

For example, if the app build version is 1.0.2 and the build scheme is staging then I want to show 1.0.2-staging, like when the app center builds the application and then the name of the application would be shown in this way (1.0.2-staging).

Fares K. A.
  • 1,273
  • 5
  • 24
  • 47
  • Hi there, you're new to Stack Overflow so we've all been in your shoes. You're getting downvoted because the quality of your question is quite low. Can I recommend you read this: https://stackoverflow.com/help/how-to-ask – Fares K. A. Sep 01 '20 at 08:38

1 Answers1

0

I am not exactly sure what you mean by "build scheme", but these are 2 examples of how to get information from the Info.plist:

let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String
Dima G
  • 1,945
  • 18
  • 22
  • this will help me to get version code in the application but I want to show like this [https://drive.google.com/file/d/1rV6-w-P3FkgYw3ntv13ZxYuimBSqEbzE/view?usp=sharing] you can see here there is the name of the application like 1.0.0-beta. that's what I want. – Nasar Iqbal Sep 01 '20 at 10:58
  • Where this word "-beta" is coming from? You can use "0-beta" as your Build (CFBundleVersion) value :) – Dima G Sep 01 '20 at 11:06
  • the beta builds variants like an environment variable. we are working in different build variants like there is a staging build variant development, beta, etc. – Nasar Iqbal Sep 01 '20 at 11:20