SQL Server 2008 и миллисекунды

Это называется вашей основной папкой пакета.

let bundleUrl = NSBundle.mainBundle().bundleURL
let bundlePath = NSBundle.mainBundle().bundlePath
let parentPath = bundlePath.stringByDeletingLastPathComponent
let appName = bundlePath.lastPathComponent

println(myParentPath)
println(appName)

изменить / обновить:

Swift 3 или новее

extension URL {
    var parentDirectory: URL? {
        return (try? resourceValues(forKeys: [.parentDirectoryURLKey]))?.parentDirectory
    }
}

let bundleURL = Bundle.main.bundleURL

if let path = bundleURL.parentDirectory?.path {
    print(path)
}
13
задан Mass Dot Net 17 November 2011 в 02:16
поделиться