Helpful Tools For Your Swift Development Toolbox

There are a number of tools that you can use to improve the output after using the Swiftify converter.

Xcode’s Swift Migration Assistant

It’s always recommended to convert to the most recent version of Swift. However, if you have chosen to convert your code to Swift 3.2, you may be interested in Xcode’s built-in Swift 4 converter (Edit → Convert → To Current Swift Syntax…).

Some behavior around @objc inference has changed in Swift 4. The Swift Migration Assistant can be helpful for cases such as adding the @objc annotation to some methods.

Remember that the recommendation is to convert to Swift 4, but the Swift Migration Assistant can be useful if you wish to upgrade from 3.2 to 4 at a later stage.

You can find more information in the Swift 4 Migration Guide.

Formatting Tools

You can use tools like SwiftFormat and Swimat to format your Swift code according to your preferences. These tools follow a set of rules to style the formatting, spacing and indentation of your Swift code.

SwiftFormat has an Xcode extension as well as a command line tool. You can customize its formatting behavior and easily run it on a folder or an entire project after converting the code to Swift.

Linting Tools

When converting from Objective-C to Swift, you may want to change parts of the output to suit the language better. Code that was written in the Objective-C way of doing things might not always be the ideal way to do it in Swift.

Linting tools, such as SwiftLint along with its SwiftLintForXcode extension, can check your code to prevent possible runtime errors. They can also be used to pick up style issues like a formatting tool.

Just because code compiles as valid Swift code doesn’t mean it’s set to the best way of doing things. Linting tools will provide warnings or errors notifying you of possible code smells or bad practices. They can inform you of better ways of doing things.

Please Share Your Thoughts

What other tools have helped you to automate certain programming tasks? How has Swiftify helped you to automate the migration process? Please let us know in the comments below.