Skip to main content

https://github.com/kylebrowning/waterwheel.swift

After a short amount searching I came across Kyle Browning Waterwheel Pod.  I flipped down to installation and there it is in three steps.  Super.  But wait.  Step one, CocoaPods.  What are pods?

https://cocoapods.org/

Easy to follow, in no time cocoapods are added.

Using terminal you need to initialise the pod to the directory where the Xcode project is located.

cd ~/Path/To/Your/Project/

pod init pod update

This will add the basic pod files to the directory where you can edit the Podfile.  I prefer to use vim through Terminal to edit the Podfile.

vi Podfile pod 'waterwheel' save - if you are not sure how to save {esc}:wq (w - write, q - quit) pod update

Following the notes on Kyle's page has the next action is to add import waterwheel to your code.  However, I found this produced an error... No such module 'waterwheel'.  Following a tonne of researching the issue was releated to the framework not being added to the project.  To add the framework, you need to add Carthage.

https://github.com/Carthage/Carthage

Note - adding this doesn't solve our problem.  It is a step along the path to the solution.  Adding the cartfile is not just simply added!  Read more detailed instructions on the Carthage create a cartfile page.

touch Cartfile open -a Xcode Cartfile github "acquia/waterwheel-swift" ~> 4.3.4 carthage update

Running the carthage update, produced the following error

A shell task (/usr/bin/env git checkout --quiet (launched in /Users/{name}/Apps/sandbar/Carthage/Checkouts/waterwheel-swift/Carthage/Checkouts/SwiftyJSON)) failed with exit code 128: fatal: reference is not a tree:

To resolve this issue, a clue was picked up from https://github.com/kylebrowning/waterwheel.swift/issues/156, being using the --use-submodules to build the frameworks.  On the initial run, the error 

A shell task (/usr/bin/env git clone --quiet /Users/{name}/Library/Caches/org.carthage.CarthageKit/dependencies/Alamofire /Users/{name}/Apps/sandbar/Carthage/Checkouts/Alamofire) failed with exit code 128: fatal: destination path '/Users/{name}/Apps/sandbar/Carthage/Checkouts/Alamofire' already exists and is not an empty directory.

I needed to do the following actions:

  • Delete all of the directories/files in the Cartage > Checkouts
  • carthage update --use-submodules --platform iOS

carthage update --use-submodules --platform iOS

Yay, the build worked this time!

So does it work now?

Adding the line import waterwheel to the code, the original error No such module 'waterwheel' remains.  The waterwheel framework needs to the Xcode project.  To do so, drag the waterwheel.framework file into the Xcode project over the framework directory.

If you have the line import waterwheel in one of your files the error will disappear.

A longer journey than I thought would be the case.  Now I need to check the connectivity through testing.

Reference to using Waterwheel