Mertalp Tasdelen
Mertalp Tasdelen

Reputation: 190

Use of undeclared type 'MainGameScreenViewController'

Hello all I had a strange problem last night in my project even if I didnt make any changes in my GameScreenViewController.swift class, its show me the use of undeclared type 'UIViewController' In code

import UIKit
import ChameleonFramework
import RealmSwift
import AVFoundation

class GameScreenViewController: UIViewController, UITableViewDelegate,UITableViewDataSource, UITextFieldDelegate, PlayerInformationCellTableViewCellDelegate {

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "mainGameScreen"{
        let nextVC = segue.destination as! MainGameScreenViewController
        for item in tempPlayers{
            nextVC.playerArray.append(item)
        }
    }
}

}

MainGameScreenViewController.swit

import UIKit
import RealmSwift
import ChameleonFramework
import AVFoundation


class MainGameScreenViewController: UIViewController {

    var playerArray: [Player] = [] //container for the player

}

full error is Use of undeclared type 'MainGameScreenViewController'

Can any one help me? I read some kind of question as I encountered but nothing solved mine.

Upvotes: 0

Views: 69

Answers (1)

Vyacheslav
Vyacheslav

Reputation: 27221

I have to include the file where you wrote missed class to the corresponding target. Just enable checkbox in the right panel of the XCode when you open the file.

Upvotes: 1

Related Questions