Apple Geek Apple Geek - 1 year ago 80
Swift Question

'Use of Unresolved Identifier' in Swift

So I have been making an app, and everything has been working great. But today I made a new class like usual and for some reason in this class I can't access Public/Global variable from other classes. All the other classes can, but now when ever I try to make a new class I can't. How would this be fixed?

I am using Swift and Xcode 6.

Working Class:

import UIKit
import Foundation
import Parse
import CoreData

var signedIn = true

class ViewController: UIViewController {


New Class:

import UIKit

class NewClass: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

signedIn = false

}


But on
signedIn = false


I get
use of unresolved identifier signedIn

Answer Source

Hum... One possible issue is that your new classe has a different Target(s) from the other one.

For example, it might have a testing target and the other doesn't. For this specific case, you have to include all of your classes in the testing target or none of them.

Targets

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download