An example of file handling for Perfect
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Perfect File Handling Example 简体中文

Get Involed with Perfect!

Star Perfect On Github Stack Overflow Follow Perfect on Twitter Join the Perfect Slack

Swift 4.0 Platforms OS X | Linux License Apache PerfectlySoft Twitter Slack Status

An example of file handling for Perfect

This package builds with Swift Package Manager and is part of the Perfect project.

Ensure you have installed Xcode 9.2 or later.

Setup - Xcode 9

  • Check out or download the project;
  • In terminal, navigate to the directory and execute
swift package generate-xcodeproj && open Perfect-FileHandling.xcodeproj
  • Select the Executable build target from the build targets dropdown in Xcode
  • Run (cmd-R) to build & run in Xcode.

In Xcode's console output pane you will see:

Perfect File Handling Examples
Working Directory set.
Created and written to testFile.txt:
Contents of testFile.txt:
Hello, World!
This file has been changed.
Contents of testFileCopy.txt:
Hello, World!
Working Directory set to parent.
File: testFile.txt
Deleting: testFile.txt
Program ended with exit code: 0

Setup - Terminal

  • Check out or download the project;
  • In terminal, navigate to the directory
  • Execute swift run

You will see output as above.


We are transitioning to using JIRA for all bugs and support related issues, therefore the GitHub issues has been disabled.

If you find a mistake, bug, or any other helpful suggestion you'd like to make on the docs please head over to and raise it.

A comprehensive list of open issues can be found at

Further Information

For more information on the Perfect project, please visit