2015-09-03 107 views
1

我是iOS開發人員的超級初學者,我有一個關於核心數據的問題。我知道這似乎是一個如此愚蠢的問題,但我很難理解這是由於描述它是什麼所涉及的所有行話。例如,https://en.wikipedia.org/wiki/Core_Data狀態:瞭解核心數據Swift

It allows data organised by the relational entity–attribute model to be serialised into XML, binary, or SQLite stores. The data can be manipulated using higher level objects representing entities and their relationships. Core Data manages the serialised version, providing object lifecycle and object graph management, including persistence. Core Data interfaces directly with SQLite, insulating the developer from the underlying SQL.

另一個鏈接:http://shrikar.com/core-data-swift-tutorial/狀態:

Core Data framework provides a simple way of maintaining the life cycle of the objects and object graph management including persistence.

而且我搜索谷歌, 「什麼是核心數據雨燕」 和大多數鏈接都差不多用他們的語言和行話。因此,瞭解它的功能真的很難。你能解釋一下外行的核心數據嗎?

P.S.我想我基本上明白了核心數據的作用。它只是保存數據,以便以後使用它?但是,這種理解足以讓我繼續使用核心數據嗎?還是需要更深入的瞭解?

回答

1

CoreData是您保存數據以供日後使用的一種方式。但是,它可以更強大。這是一個對象圖從這個意義上說你可以創建relationships多個對象一起形成如此種類的關係。

在非常簡單的應用程序中,核心數據可用作Dictionary,在關閉應用程序時不會丟失數據。但是,它可以更多。

CoreData的一個應用程序超出了存儲數據的簡單方法,可以保存多個「Person」對象並創建許多社交應用程序使用的Follower/Follow模型。也許你想查詢你保存的數據模型:「找到跟蹤這個人的所有用戶」。核心數據中建立的關係將允許您在保存的數據庫中進行這種查詢。