Home > database >  Why am I receiving "Cannot find 'performSegueWithIdentifier' in scope" in Swift?
Why am I receiving "Cannot find 'performSegueWithIdentifier' in scope" in Swift?

Time:12-22

I am writing my application in Swift. Here is the viewDidLoad() function:


override func viewDidLoad() {
        super.viewDidLoad()
        if !self.check_file() {
            print("Missing file to read")
            performSegueWithIdentifier("missingfileViewController", sender: nil)
        }
        
        
        
        
    }

Here is check_file() function:

func check_file() -> Bool {
        let fileManager = FileManager.default
        return fileManager.fileExists(atPath:"/Applications/Readfile.app/Contents/Resources/textfile/readthis.txt") 
      
        
    }

I'm receiving this error Cannot find 'performSegueWithIdentifier' in scope. Can anyone help me with this? Great thanks EDIT: I have even tried to use self.performSegueWithIdentifier, but another error comes up: Value of type 'ViewController' has no member 'performSegueWithIdentifier'

CodePudding user response:

self.performSegue(withIdentifier: "missingfileViewController", sender: self)

try this

  • Related