Below is a custom function I made to do this. It takes one parameter a NSURL and returns a string as a absolute file path
func myFileString(theFile: NSURL) -> String {
return theFile.absoluteString
}
And if you need to convert the string as a absolute file path back to a NSURL this custom function does that. It takes one parameter a string as a absolute file path.
func myFileStringURL(tFileString: String) -> NSURL {
return NSURL(fileURLWithPath: tFileString!)
}
As you can see not very hard, but useful. Making custom functions for later reuse of code for future project can be helpful. These work for Swift and Mac OS X with Swift v 1.1
Thanks, and happy coding ;)
Hi there! As a developer, you may appreciate an online localization tool like https://poeditor.com/ which can let you easily manage your translation projects.
ReplyDelete