4

My error is really as simple as the title says. I am trying to import a specific module, called IBAnimatable. the statement works just fine in one file, and Xcode does not give me any complaints at all, however while doing the exact same thing again in another file, it suddenly starts to complain. I have tried cleaning the project and building it again multiple times. I cannot understand why this is happening at all. This error merely just randomly showed up after trying to build the project. There were not edits done to that file, and it was previously working. The code for the working file with the import, and the file which doesn't work are down below.

This is the code of the file which isnt working, it was giving the error that No such module 'IBAnimatable'

import UIKit
import IBAnimatable

class ContactsTableViewCell: UITableViewCell {
    @IBOutlet var username: UILabel!
    @IBOutlet var profilePic: AnimatableImageView!
}

Yet while it gives me that error, this code builds just fine in another file:

import UIKit
import IBAnimatable

class FavoriteTableViewCell: UITableViewCell {
    @IBOutlet var profilePic: AnimatableImageView!
    @IBOutlet var username: UILabel!
}

I don't know if this holds any significance to this error, but previously today I have changed the name of the app too, however I was able to build and run the app with both of these files being the exact same as you see them now. I have also recently turned on push notifications on the app, however even after doing this these two files were building and running just fine. This error really did just randomly show up, and while dealing with xcode for a decent amount of time, I simply thought cleaning it and building it again would fix it however, this was not the case.

Edit: A restart of Xcode also did not fix the problem.

Edit 2: Clearing derived data did not help either.

Edit 3: I don't know if this is important, but I commonly am starting to get the error Command CompileSwift failed with a nonzero exit code, but upon building the project multiple times as shown in the first answer here: Build fails with "Command failed with a nonzero exit code", that error was fixed, however the other error remained.

Community
  • 1
  • 1
Rishi
  • 399
  • 6
  • 23
  • 3
    If you open the File Inspector (⌥⌘1) and check your two files, are they members of the same target(s)? – zneak Feb 09 '19 at 00:39
  • Yup I just checked, they both show that they are the same target, if it was supposed to be under the `Target Membership` group of the command you just gave. In fact, when I switch between the two files, quite literally the only things that change are the File Path, Location, and Name in the File Inspector. – Rishi Feb 09 '19 at 01:20
  • Is it possible for you to create a copy of that project and remove everything from it except these two files and post that? – zneak Feb 09 '19 at 08:57
  • Do you want me to just copy the code, or the complete files to include any file encoding issues? – Rishi Feb 09 '19 at 13:51
  • The least code you can with which your issue reproduces. – zneak Feb 09 '19 at 16:54
  • Have you tried duplicating the files, deleting the original files, then rebuilding? – bwc Feb 15 '19 at 16:41

1 Answers1

-2

Had a similar issue, apparently Git was messing it up. Removing Git got it working.