Skip to content

gherkin with xcode

Tyler-Keith-Thompson edited this page Dec 1, 2019 · 2 revisions

NOTE: The following script need to be run with sudo so if you keep them in your podfile that may get annoying.

If you are using Carthage your best bet is to simply download and execute the scripts from the repo

Gherkin Syntax Highlighting

CucumberSwift supports syntax highlighting for Gherkin! In order to take advantage of it add this line to your podfile:

pod 'CucumberSwift/syntax'

Then add this post-install hook

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name.include? 'CucumberSwift'
      system("cd Pods/CucumberSwift/CucumberSwift/Gherkin/XCode-Specific && sudo ./gherkin_colors_xcode.sh")
    end
  end
end

Gherkin Snippets

CucumberSwift supports gherkin code snippets! This allows for easy autocomplete or a drag-and-drop gherkin block to easily create new features and scenarios. In order to take advantage of it add this line to your podfile:

pod 'CucumberSwift/snippets'

Then add this post-install hook

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name.include? 'CucumberSwift'
      system("cd Pods/CucumberSwift/CucumberSwift/Gherkin/XCode-Specific && sudo ./copy_snippets.sh")
    end
  end
end

Future:

This may be worth moving to Homebrew, these scripts only need to be executed once each time there's an update