I am trying to use the function made by Martin R as an answer to this question: Get terminal output after a command swift
However, the UnsafePointer line no longer works with Swift 3 and I'm having trouble figuring it out. How would I adapt this code to Swift 3?
if var string = String.fromCString(UnsafePointer(outdata.bytes)) {
string = string.stringByTrimmingCharactersInSet(NSCharacterSet.newlineCharacterSet())
output = string.componentsSeparatedByString("\n")
}
ps, You need to "Import Cocoa" if you want to trying using the function.