123ZDP
123ZDP

Reputation: 137

Class won't show up

I just had this code working a couple days ago now it is giving me an error:

Unknown class DraggableImage in Interface Builder file.

I have tried cleaning the file, restarting both my computer and Xcode multiple times, but nothing will work. I know there are questions like this but nothing they have said have worked for me. Also the class isn't in the drop down menu It is in the ViewDidLoad section.

My code:

class DraggableImage : UIImageView {

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.isUserInteractionEnabled = true
    }

    override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
        let touch = touches.first;
        let location = touch?.location(in: self.superview);
        if location != nil {
            self.frame.origin = CGPoint(x: location!.x-self.frame.size.width, y: location!.y-self.frame.size.height);
        }
    }
}

Upvotes: 0

Views: 70

Answers (2)

Codus
Codus

Reputation: 1473

Make sour your Module is current - {Your Project} but not None expected Module

Upvotes: 1

DonMag
DonMag

Reputation: 77452

Edit: hmmm... this might not be what you're having trouble with... I'll delete this answer if that's the case.

Search for it as a text string in your whole project. It should show up like this:

enter image description here

Upvotes: 0

Related Questions