When it sees the latest source code for the Swift standard library, it String.init(contentsOfFile:)internally calls NSString.init(contentsOfFile:usedEncoding:). ( NSStringAPI.swift )
And the version of Linux NSString.init(contentsOfFile:usedEncoding:), as you can see, is not yet implemented. ( NSString.swift )
It seems to be NSString.init(contentsOfFile:encoding:)already implemented and String.init(contentsOfFile:encoding:)calls it. So, if you know the encoding of the file, use String.init(contentsOfFile:encoding:)as:
let fileContent = try? String(contentsOfFile: filePath, encoding: .utf8)
, .