Getting content of file on Mac

How to get content of file using Swift? I've tried FileManager.default.contents(atPath: "/Users/tigrankashapov/Songs/test.mp3") in my Xcode project, but it returned nil. But I also tried the same code in playground mode and it worked.

It is probably a matter of sandbox entitlements. That Swift code is correct, but Xcode wraps the produced executable in a bunch of system‐specific things which block certain actions from the outside.

This forum is focused on the Swift language itself, so for information about sandboxes and other things Xcode does, you can try the Apple Developer Forums or do an internet search.

thanks