最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]Xcode创建iOS Swift项目时的Use Core Data是做什么的

iOS crifan 4209浏览 0评论

Xcode创建iOS的Swift项目时的Use Core Data

use core data when create swift ios app

是啥意思
[解决过程]
1.搜:

xcode iOS use core data meaning
参考:
Checking the Use Core Data box will cause Xcode to generate boilerplate code for what’s known as a Core Data stack in AppDelegate.swift.
The Core Data stack consists of a set of objects that facilitate saving and retrieving information from Core Data. There’s an object to manage the Core Data state as a whole, an object representing the data model, and so on.
Note: Not all Xcode templates under iOS/Application have the option to start with Core Data. In Xcode 7, only the Master-Detail Application and the Single View Application templates have the Use Core Data checkbox.
The idea for this sample app is simple. There will be a table view with a list of names for your very own “hit list”. You’ll be able to add names to this list and eventually, you’ll use Core Data to make sure the data is stored between sessions.
Since you elected to use Core Data when you created the HitList project, Xcode automatically created a data model file for you and named it HitList.xcdatamodeld.
Core Data is not a Database
When we talk about persistent data, people probably think of database. If you are familiar with Oracle or MySQL, you know that relational database stores data in the form of table, row and column, and it usually facilitates access through what-so-called SQL query. However, don’t mix up Core Data with database. Though SQLite database is the default persistent store for Core Data on iPhone, Core Data is not a relational database. It is actually a framework that lets developers store (or retrieve) data in database in an object-oriented way. With Core Data, you can easily map the objects in your apps to the table records in the database without even knowing any SQL.
[总结]
CoreData,是一个框架,可以让开发者很方便的,以对象的方式去,调用对应的数据存取接口去存取数据。
需要注意的是:CoreData不是一个关系数据库,虽然底层实现是用的SQLite去实现数据存储的。
用Xcode创建项目的时候,只有Master Detail View 和Single Application View才有Use Core Data选项的。
 对应的架构是:
use core data arch ios

转载请注明:在路上 » [已解决]Xcode创建iOS Swift项目时的Use Core Data是做什么的

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
85 queries in 0.171 seconds, using 22.11MB memory