You can get that easily by using single variable and make it public. You can use it everywhere you want.

(I am getting here User Agent for API header)

public let userAgent: String = {
if let info = Bundle.main.infoDictionary {
let executable = info[kCFBundleExecutableKey as String] as? String ?? "Unknown"
let bundle = info[kCFBundleIdentifierKey as String] as? String ?? "Unknown"
let appVersion = info["CFBundleShortVersionString"] as? String ?? "Unknown"
let appBuild =

--

--

iOS Developer, Triple graduated, Passionate, Love workout, blogger

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mr.Javed Multani

iOS Developer, Triple graduated, Passionate, Love workout, blogger