I'm trying to pass the ILTItem variable into my ILTViewController, triggered by AppDelegate.swift when the user launches my app via a deeplink.
The code I have errors with:
Cannot call value of non-function type 'String'
on the line where I define ilt
.
Here's the code I have at the moment:
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
var ilt = ILT(homeworkID: 1234, title: "History ILT", subject: "History", teacher: "Miss A Smith", teacherCode: "asmith", studentID: 12345, description: "Description....", due: 1450137600, status: "In Progress", hasAttachments: true)
var newVC = ILTViewController()
newVC.ILTitem = ilt
appDelegate.window?.addSubview(newVC.view)
Why could this be? In my ILTViewController class I have:
class ILTViewController: UIViewController {
// accept the incoming ILT struct
var ILTitem: ILT!
IlT Struct Declaration:
struct ILT {
let homeworkID: Int
let title: String
let subject: String
let teacher: String
let teacherCode: String
let studentID: Int
let description: String
let due: Double
let status: String
let hasAttachments: Bool
}
ILT
class declaration – AccommodativeString
variable namedILT
somewhere else and that's why it fails. – AccommodativenewVC.ILTItem = ILT(homeworkID: 1234, title: "History ILT", subject: "History", teacher: "Miss A Smith", teacherCode: "asmith", studentID: 12345, description: "Description....", due: 1450137600, status: "In Progress", hasAttachments: true)
it still fails with the same message. – UnpagedILT
(uppercase), notilt
(lowercase). The error is telling you that you are trying to call aString
instead of a method (struct constructor in your case). And, as you can check in the link I provided, the error is elsewhere in your code, because the code you posted works fine. – Accommodative