Xcode Project folders can be a messy place. Today we'll check out a tool from the folks at Venmo that can help us tidy up called Synx. Let's take a look.
At its core, Synx's main purpose is to reorganize the files and folders in our Xcode project folder to match the groups and structure we've setup inside Xcode's Navigator pane.
We can start by organizing a project full of content:
Then we'll install Synx:
gem install synx
Then we can simply head into our project's directory and run the main command:
Synx will work its magic and re-organize our files on disk, creating directories and moving files as needed to make things match the groups in our project.
Additionally, we can also use Synx to remove files no longer referenced in our project, like this:
synx --prune ./OCMock.xcodeproj
We're also provided a couple arguments to help us control how Synx behaves.
We can exclude files:
synx --exclusion /OCMockTests ./OCMock.xcodeproj
Last but not least, for those of us who like to manually sort our files by concept rather than name, we can disable sorting:
synx --no-sort-by-name ./OCMock.xcodeproj
Choosing how to organize projects can be a very subjective and personal choice, this is just one approach. Always use whatever works best.