我想用swift替换我的CI bash脚本.我无法弄清楚如何调用普通的终端命令,如ls或xcodebuild
#!/usr/bin/env xcrun swift
import Foundation // Works
println("Test") // Works
ls // Fails
xcodebuild -workspace myApp.xcworkspace // Fails
Run Code Online (Sandbox Code Playgroud)
$ ./script.swift
./script.swift:5:1: error: use of unresolved identifier 'ls'
ls // Fails
^
... etc ....
Run Code Online (Sandbox Code Playgroud) 我已经在Swift 2中使用过这种方法
var myDict: NSDictionary?
if let path = NSBundle.mainBundle().pathForResource("Config", ofType: "plist") {
myDict = NSDictionary(contentsOfFile: path)
}
Run Code Online (Sandbox Code Playgroud)
但是不知道如何在不使用NSDictionary的情况下读取Swift3中的plist (contentsOfFile:path)