Quick: No autocompletion when using Carthage

Created on 4 Nov 2016  ยท  10Comments  ยท  Source: Quick/Quick

So I'm stumped.

I'm using Carthage to bring in Quick and Nimble into my project. I'm also using Carthage to bring in some of our other internal frameworks. Our internal frameworks are great, however, the Quick and Nimble frameworks used in my tests receive no autocompletion love, and odd editor parsing/indexing behaviour. Everything will build fine, but syntax highlighting is haphazard, there's no autocompletion or code hints, etc. Here's some pics:

screen shot 2016-11-04 at 9 15 45 am

screen shot 2016-11-04 at 12 17 58 am

I should note I'm only experiencing this with Quick and Nimble, but not the 1 or 2 other Carthage frameworks I'm depending on.

Quick Setup

I'm on an mid/early 2015 MBP, running OS X 10.11.6, running Xcode 8.1

Here's what I've done

  1. I created a Cartfile.private
    > # Frameworks for testing that are far better than Apple's crappy XCTest
    > github "Quick/Quick"
    > github "Quick/Nimble"
  2. I do a carthage update --platform iOS, things are pulled, cities built, people fall in love.
  3. I drag the two frameworks from the Carthage/Build/iOS folder and into the breatheAgainTests target's Build Phases -> Link Binary With Libraries
  4. I add the two frameworks to the breatheAgainTests target's Build Phases -> Copy Files
    screen shot 2016-11-04 at 9 26 38 am

Still not seeing consistent highlighting or parsing

After the above and still not seeing consistent highlighting or parsing, I decided to try the following. Between each of the steps taken I did a Product -> Clean, Product -> Clean Build Folder, and deleted the ~/Library/Developer/Xcode/DerivedData directory.

  • On all targets I set Apple LLVM 8.0 - Language - Modules -> Enable Modules (C and Objective-C) to No
  • In the breatheAgain project -> PROJECT breatheAgain (note: the actual project, not a target) -> Search Paths -> Framework Search Paths I added $(PROJECT_DIR)/../Carthage as recursive
  • I actually upgraded to Xcode 8.1 hoping blindly it would magically resolve this. I then blew away my Carthage directory and regenerated all the frameworks. Still no dice.

A plea for help

Has anybody experienced this level of stubbornness with using Frameworks and not cocoa pods? I'm kinda shocked by how difficult this has been. Am I missing something in my setup? Do the apple gods hate me? Asking for a friend.

Any help would be _yuge_. I can't post a link to the project as it's, unfortunately, for the organization, but I will try to accommodate all and any requests for further information.

Much love!

question setup issues

Most helpful comment

Quick update @istx25 - This is now working. Most of what I had in my project targets already aligned with what you had.

There was one major difference, however, and I don't really understand why it would matter: I have a workspace at a level above my project (naturally), and my Carthage stuff was at the workspace level, not at the project level.

I didn't think this would actually be a big deal so long as my Framework Search Path was set appropriately ($(SRCROOT)/../Carthage/**) but, apparently, it _is_ a big deal... but only within the unit test target. So very strange. Perhaps there's some kind of internal Xcode thing where assumptions are made, or how things are resolved in test targets or something... I'm not sure.

In any case, I moved my Cartfile* down one deeper, into the project directory, and ran a carthage update --platform iOS after setting up the various project stuff correctly. And it all worked just wonderfully.

A huge thank you for all the help you provided. It was, quite honestly, some of the best help I've ever received from the OSS community. You really went the extra distance. I wish I could give you some gold.

Cheers!

All 10 comments

Hi there! Thanks for reaching out, @ryanbaldwin. Happy to help. ๐Ÿ˜บ I believe the problem you were experiencing has to do with your project setup so here's a few personalised resources:

I setup a fresh Swift 3 Xcode project with Quick and Nimble using Carthage. You can download the zip file here. Feel free to look around.

I also recorded a _quick_ :smirk: video going through the process and explaining each step. You can download the video by going here.

tldr?

  1. Add the Quick and Nimble frameworks in the navigator area.
  2. Navigate to "Build Phases" on the test target.

    • Create a new Run script (press the plus button on the top left).

    • Put /usr/local/bin/carthage copy-frameworks in the main section.

    • Add $(SRCROOT)/Carthage/Build/iOS/Nimble.framework in the "Input Files" section.

    • Add $(SRCROOT)/Carthage/Build/iOS/Quick.framework in the "Input Files" section.

  3. Open your test file and import Quick and Nimble.

    • import Quick and import Nimble

And then you're good to go!

Let me know if you have any other problems or follow-up questions and I'd be happy to help you some more. ๐Ÿ˜„ โœจ โค๏ธ

Also, I wanted to comment on this as well:

Frameworks for testing that are far better than Apple's crappy XCTest

github "Quick/Quick"
github "Quick/Nimble"

Although XCTest can be frustrating at times, be mindful that XCTest is what Quick (and many other awesome testing tools) are built off of in iOS/macOS/etc. We stand on the shoulders of giants so we can provide great tools and experiences. It's inspired many to build something better and now that Apple runs an open sourced version of XCTest, we'll start to see a feedback loop.

And that's what we're trying to do - help make better tools, techniques and technologies for teams and communities - if that's for Quick or XCTest (or something else). We're all in it together and inspired by each other's work because we have a common goal: to make amazing software.

Just thought I'd get that off my chest. ๐Ÿ’ฏ โค๏ธ

@istx25 - You're right about XCTest. I didn't mean to sound snarky and, truth be told, I'd forgot that's what was actually in the file. You're right that XCTest supports a good foundation for others to build great tooling and technologies, and it's not something I intended to crap all over. It's been a long couple days and I think my frustrations leaked out a bit.

Everybody has done great work here, and I super appreciate what y'all have done, and the incredible support you gave me in the above post (which I'll be trying now). You're right - be thankful and grateful instead of a soon to be cold, shivering, embittered canuck. ;)

๐Ÿ˜

Totally understandable! I've been there and I'm pretty sure it's safe to say most, if not all of us have been. The "I wish I could chuck my Mac out the window" moments but you know you won't because your mac's worth too many thousands of dollars and you don't have enough to replace it. ๐Ÿ˜œ

Anyways, let me know if the video + sample project is helpful. If that doesn't resolve your problem, comment back and we can try something else! I'm also Canadian btw so it's totally normal to be cold and shivering in Canada. ๐Ÿ˜‰

Quick update @istx25 - This is now working. Most of what I had in my project targets already aligned with what you had.

There was one major difference, however, and I don't really understand why it would matter: I have a workspace at a level above my project (naturally), and my Carthage stuff was at the workspace level, not at the project level.

I didn't think this would actually be a big deal so long as my Framework Search Path was set appropriately ($(SRCROOT)/../Carthage/**) but, apparently, it _is_ a big deal... but only within the unit test target. So very strange. Perhaps there's some kind of internal Xcode thing where assumptions are made, or how things are resolved in test targets or something... I'm not sure.

In any case, I moved my Cartfile* down one deeper, into the project directory, and ran a carthage update --platform iOS after setting up the various project stuff correctly. And it all worked just wonderfully.

A huge thank you for all the help you provided. It was, quite honestly, some of the best help I've ever received from the OSS community. You really went the extra distance. I wish I could give you some gold.

Cheers!

That's great to hear. I'm glad I was helpful. ๐Ÿ’› I'm here to help people and build the community so no worries. If you'd really like to _give me some gold_, buy me a coffee one day! โ˜•๏ธ In the meantime, I'll look into if I can replicate the problem with the Xcode Workspace. I'm not aware of anything that would cause that but we can see if we can fix it (or get Apple to)! ๐Ÿš€

Hit me up on Twitter or Telegram if you'd like. My username is the same as here. Would be nice to make a new connection. ๐Ÿ’ƒ

@istx25 thank you for post. I was missing import of quick and nimble in my test class. My auto complete is working again. After hour and hours of pain ...it's working! are you an Xcode god?

send digital hug dude thank so much!

Thank you for taking the time to comment something nice. โค๏ธ
"Are you an Xcode god?" made my day. ๐Ÿ˜œ

Glad I could help. ๐Ÿ™‚

@istx25 haha your welcome

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ivanruizscm picture ivanruizscm  ยท  7Comments

J-Rojas picture J-Rojas  ยท  4Comments

cjwirth picture cjwirth  ยท  5Comments

ivangodfather picture ivangodfather  ยท  7Comments

sunshinejr picture sunshinejr  ยท  4Comments