CopyPastor

Detecting plagiarism made easy.

Score: 1.9543217693011385; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2019-12-31
by jawadAli

Original Post

Original - Posted on 2018-12-10
by Giang



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Bundle+Extensions.swift
import Foundation extension Bundle { var versionNumber: String? { return infoDictionary?["CFBundleShortVersionString"] as? String } var buildNumber: String? { return infoDictionary?["CFBundleVersion"] as? String } var bundleName: String? { return infoDictionary?["CFBundleName"] as? String } }
Usage:
versionLabel.text = Bundle.main.versionNumber
You need to use correct bundle name in case to get version number of either framework or main application
Also you can search the bundle by identifier (the frameworks bundle ID):
let bundle = Bundle(identifier: "com.myframework")
Bundle+Extensions.swift
import Foundation extension Bundle { var versionNumber: String? { return infoDictionary?["CFBundleShortVersionString"] as? String } var buildNumber: String? { return infoDictionary?["CFBundleVersion"] as? String } var bundleName: String? { return infoDictionary?["CFBundleName"] as? String } }
Usage:
someLabel.text = Bundle.main.versionNumber

        
Present in both answers; Present only in the new answer; Present only in the old answer;