ios - Cannot call value of non-function type 'String' -
i'm trying pass iltitem variable iltviewcontroller, triggered appdelegate.swift when user launches app via deeplink.
the code have errors with:
cannot call value of non-function type 'string'
on line define ilt.
here's code have @ moment:
let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate var ilt = ilt(homeworkid: 1234, title: "history ilt", subject: "history", teacher: "miss 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 be? in iltviewcontroller class have:
class iltviewcontroller: uiviewcontroller { // accept 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 }
the error telling you trying call string instead of method (struct constructor in case). you've declared string variable named ilt (uppercase) somewhere else , that's why fails.
your posted code works fine error must somewhere else in code.
Comments
Post a Comment