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 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:
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:
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:
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.
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:
Check the Tools | Swiftify menu and convert some code:
That’s it! Of course, you can set the shortcut for each Swiftify action in Preferences | Keymap:
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.
Today we are starting the Early Access Program for AppCode 2017.2. The first build is already available on our site, so let’s see what’s on board!
Override/Implement via completion
This build brings one of the long-awaited features from our roadmap – Swift override/implement via completion in the editor! Just type the name of the entity you need to override or implement, select it in the completion list and have the corresponding stub automatically generated by AppCode:
Intention for required protocol methods
In AppCode you can implement required protocol methods for the class derived from a protocol. Simply press ⌥ ⏎ on the Objective-C class name:
The same functionality is now available for Swift protocols:
Now settings for blank lines between properties and methods can be configured separately for classes and protocols:
Besides, you can toggle spaces within braces in Swift code using Editor | Code Style | Swift | Spaces | Within | Code braces.
AppCode is now able to parse __auto_type expressions in Objective-C/C/C++ and shows the __auto_type keyword in the completion list:
The following major issues are fixed in this build: