Skip to content

Commit

Permalink
Fallback to CFBundleName if CFBundleDisplayName is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobminer committed Jul 5, 2018
1 parent e7ff509 commit 20d229e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Switchcraft/Classes/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public struct Config {
* Default is the current build name and version number.
*/
public var alertMessage: String? {
if let bundle = Bundle.main.infoDictionary,
let displayName = bundle["CFBundleDisplayName"] as? String,
let versionString = bundle["CFBundleShortVersionString"] as? String,
let buildNumber = bundle["CFBundleVersion"] as? String {
return displayName + " " + versionString + "-" + buildNumber
guard let bundle = Bundle.main.infoDictionary,
let displayName = (bundle["CFBundleDisplayName"] as? String) ?? (bundle["CFBundleName"] as? String),
let versionString = bundle["CFBundleShortVersionString"] as? String,
let buildNumber = bundle["CFBundleVersion"] as? String else {
return nil
}
return nil
}

return displayName + " " + versionString + "-" + buildNumber
}
/**
* The alert view text field placeholder.
* Default is "Enter Value".
Expand Down

0 comments on commit 20d229e

Please sign in to comment.