I'm using Swift
and the newest Xcode
version.
I have this code in AppDelegate.swift
:
func testPrint(string: String) {
print(string)
}
I can successfully call the function from the file ViewController.swift
like this:
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.testPrint(string: "Hello!")
But if I'm trying to call the function from TodayViewController.swift
, which is for Apples Today Extension
, I'm getting the following error:
Use of undeclared type 'AppDelegate'
Why that?