How to check file is writable in Swift

You can use the following code in iOS app development to check the whether the operation system appears able to execute a given file