Skip to content

Commit

Permalink
Add static vars for getting schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoffer Winterkvist committed Oct 16, 2015
1 parent c2105e4 commit f31a479
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Source/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,28 @@ public struct Application {

public static var version: String = {
return Application.getString("CFBundleShortVersionString")
}()
}()

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

public static var bundle: String = {
return Application.getString("CFBundleURLName")
}()

public static var schemes: [String] = {
guard let infoDictionary = NSBundle.mainBundle().infoDictionary,
urlTypes = infoDictionary["CFBundleURLTypes"] as? [AnyObject],
urlType = urlTypes.first as? [String : AnyObject],
urlSchemes = urlType["CFBundleURLSchemes"] as? [String]
else { return [] }

return urlSchemes
}()

public static var mainScheme: String? = {
return schemes.first
}()

}

0 comments on commit f31a479

Please sign in to comment.