Jam*_*mes 23 struct viewcontroller ios swift
我正在尝试将ILTItem变量传递到我的ILTViewController,当用户通过深层链接启动我的应用程序时,由AppDelegate.swift触发.
我有错误的代码:
无法调用非函数类型'String'的值
在我定义的行上ilt.
这是我目前的代码:
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)
Run Code Online (Sandbox Code Playgroud)
为什么会这样?在我的ILTViewController类中,我有:
class ILTViewController: UIViewController {
// accept the incoming ILT struct
var ILTitem: ILT!
Run Code Online (Sandbox Code Playgroud)
IlT结构声明:
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
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
51786 次 |
| 最近记录: |