How To Setup Quick And Nimble Using Cocoapods

Pratima S
3 min readMay 10, 2020

--

Follow the steps to reliable setup of Quick and Nimble:

Prerequisites:

cocoapods installed in your machine (installation Guide)

1) create a new Xcode project

Xcode → File → New → Project

2) Select Single View App (Normally most of the application use this) →Next

- Enter Product Name (App NAme) — (here we are using WeatherForecast)

- enable check mark for Include Unit Tests

3 )Installation

Open terminal

Move to your working directory cd (path of your project folder)

Ex: enter in terminal

cd /Users/Documents/ WeatherForecast

4) Initialise pods with

Pod init

5) Open the newly created Podfile within your favourite text editor.

edit podfile with below contents

# Uncomment the next line to define a global platform for your project

platform :ios, ‘9.0’

target WeatherForecast’ do

# Comment the next line if you don’t want to use dynamic frameworks

use_frameworks!

# Pods for WeatherForecast

target ‘WeatherForecastTests’ do

inherit! :search_paths

# Pods for testing

pod ‘Quick’

pod ‘Nimble’

end

end

5) Save the podfile.Return to terminal and

enter pod install in terminal

6) This will install your new frameworks and create a pods project. It will also generate a workspace. You should now use the new workspace when working on your project. So if you’ve opened your project already close it and in open the WeatherForecasr.xcworkspace instead.

7) Setting up your test class

Within your tests target create a new group and file by:

Highlighting WeatherForecast Tests.

File →New → Group

Rename the new Group ModelTests

Highlight your new group

File →New → File

Select Swift file, Press Next

- Name the new file CurrentSpecs . Press create

7) Within your new file replace the contents with the following

import Foundation

import Quick

import Nimble

@testable import WeatherForecast

class CurrentWeatherSpecs: QuickSpec {

}

*After this you might face an error

“No such Module Quick”

“No such Module Nimble”

Below steps worked to Fix the error

Try the following:

1. Open xcode schemes list.

2. Tick Nimble and Quick with “show” and close.

3. Select Nimble as a scheme and build (cmd + b)

4. Select Quick as a scheme and build (cmd + b)

5. Change scheme back to your app scheme and see if the error is gone and autocompletion works.

This is what I have to do from time to time.

--

--

No responses yet