Last active
June 21, 2017 08:38
-
-
Save christianascone/7d9cee7c0d79738fac172048492ea0aa to your computer and use it in GitHub Desktop.
Version Utils class for finding info about app version and build number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// VersionUtils.swift | |
// | |
// Created by Christian Ascone on 21/06/2017. | |
// Copyright © 2017 Christian Ascone. All rights reserved. | |
// | |
import Foundation | |
class VersionUtils { | |
/// If found in infoDictionary, returns the app version | |
static func getVersion() -> String { | |
if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { | |
return version | |
} | |
return "" | |
} | |
/// If found in infoDictionary, returns the build number | |
static func getBuildNumber() -> String { | |
if let version = Bundle.main.infoDictionary?["CFBundleVersion"] as? String { | |
return version | |
} | |
return "" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment