JohnnyDark / IOS_Checklist

0 stars 0 forks source link

DataModel #4

Open JohnnyDark opened 4 years ago

JohnnyDark commented 4 years ago

DataModel

Checklist

ChecklistItem

JohnnyDark commented 4 years ago
  1. Date Model持有 Checklist的数组
  2. Checklist对象持有ChecklistItem数组
  3. Date Model的初始化方法中,读取.plist文件数据,并赋值给他的Checklists数组,在AppDelegate中完成
  4. AppDelegate中通过代码获取到root view controller并将DateModel中Checklists数组数据传递给root view controller
JohnnyDark commented 4 years ago

AppDelegate中获取view controller并传递数据

App启动时,AppDelegate.swift的didFinishLaunchWithOptions方法中进行数据加载,与变量赋值
  let navigationController = window!.rootViewController 
                             as! UINavigationController
  let controller = navigationController.viewControllers[0] 
                   as! AllListsViewController
  controller.dataModel = dataModel