You may get something like the following error when you open your Swift code in Xcode 7 beta:
'lastPathComponent' is unavailable: Use lastPathComponent on NSString instead.
Solution is to do something like this:
let lastPathComponent = (fileName as NSString).lastPathComponent