Tips & Tricks

Three AppCode plugins for Swift development

There are a lot of helpful plugins in AppCode plugin repository – such as, for example, the Markdown support. Today we will take a look at three plugins dedicated to Swift development.

SwiftLint

SwiftLint is a static analysis tool by Realm that helps you enforce Swift style and conventions in your project. You can use it in AppCode in the same way as in Xcode, by adding the corresponding build phase into your project settings. However, it may be easier to configure it once for all projects. To do that, install the SwiftLint plugin directly from Preferences | Plugins:
SwiftLint
Restart AppCode and open Preferences | Tools | SwiftLint. Here you can set the path for the SwiftLint executable (default is /usr/local/bin/swiftlint), select if you want the Autocorrect quick-fix to appear for each SwiftLint warning, or disable SwiftLint if there is no .swiftlint.yml in the root folder of your project:

SwiftLint preferences
Finally, you should be able to see SwiftLint diagnostic messages right in your code editor window and be able to invoke swiftlint autocorrect for the current file using the Autocorrect quick-fix:
Autocorrect

Swift Mock Generator

Swift Mock Generator
This awesome plugin automatically generates mock classes for Swift protocols and has the following features:

  • Captures invocation status of a method.
  • Captures invoked method parameters.
  • Stubs values for your mocks to return.
  • Automatically calls closure parameters with stubbed values.
  • Supports mocks conforming to one or many protocols.
  • Handles overloaded method declarations.
  • Regenerates your mock in one action.
  • Supports associated types.
  • Respects public mocks and makes queries publicly available.

Read the full overview of its functionality here.

Swiftify

Swiftify is a paid tool that aims to be a full-featured Objective-C to Swift converter. Now you can configure and use it directly in AppCode by installing the plugin by the Swiftify team. Enter your API key in Preferences | Tools | Swiftify:
Swiftify preferences
Check the Tools | Swiftify menu and convert some code:
Convert to Swift
That’s it! Of course, you can set the shortcut for each Swiftify action in Preferences | Keymap:
Swiftify actions
Using any other useful plugins with AppCode? Tell us about them in the comments section below, and we’ll include it in the next blog post about plugins.

Your AppCode team
JetBrains
The Drive to Develop