Note: this should work, but it really doesnβt work - there must be an error. I leave this here to document that it does not work, may work in the future, but for the time being it is best to use the accepted answer.
I discovered the following type types from the Swift API:
typealias FourCharCode = UInt32 typealias OSType = FourCharCode
And the following functions:
func NSFileTypeForHFSTypeCode(hfsFileTypeCode: OSType) -> String! func NSHFSTypeCodeFromFileType(fileTypeString: String!) -> OSType
This should allow me to create equivalent code:
let type : UInt32 = UInt32(NSHFSTypeCodeFromFileType("TEXT")) let creator : UInt32 = UInt32(NSHFSTypeCodeFromFileType("pdos"))
WARNING: But this does not work on Xcode 7.0 beta (7A121l)
source share