Skip to content

Commit

Permalink
Merge pull request #12 from hyperoslo/improve/application-struct
Browse files Browse the repository at this point in the history
Add exectuable to Application struct
  • Loading branch information
vadymmarkov committed Oct 16, 2015
2 parents 964d31e + c2105e4 commit 74bdeff
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Source/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@ import UIKit

public struct Application {

private static func getString(key: String) -> String {
guard let infoDictionary = NSBundle.mainBundle().infoDictionary,
value = infoDictionary[key] as? String
else { return "" }

return value
}

public static var name: String = {
var name = ""
if let infoDictionary = NSBundle.mainBundle().infoDictionary,
bundleName = infoDictionary["CFBundleDisplayName"] as? String {
name = bundleName
}
return name
return Application.getString("CFBundleDisplayName")
}()

public static var version: String = {
var version: String = ""
if let infoDictionary = NSBundle.mainBundle().infoDictionary {
version = infoDictionary["CFBundleShortVersionString"] as! String
}

return version
return Application.getString("CFBundleShortVersionString")
}()

public static var executable: String = {
return Application.getString("CFBundleExecutable")
}()

}

0 comments on commit 74bdeff

Please sign in to comment.