Swift. App의 버전 정보 가져오기

Version, Build...

Posted by MinJun on Saturday, February 24, 2018 Tags: Swift   1 minute read
var version: String? {
    guard let dictionary = Bundle.main.infoDictionary,
        let version = dictionary["CFBundleShortVersionString"] as? String,
        let build = dictionary["CFBundleVersion"] as? String else {return nil}
    
    let versionAndBuild: String = "vserion: \(version), build: \(build)"
    return versionAndBuild
}

Reference

Xcode 빌드시, Version, Build 차이점
Version vs Build in Xcode