简体   繁体   中英

Adding core data to existing tabbed application (ios swift, Xcode6)

I've created a mess around To Do list app in Tabbed Application, Xcode 6 beta. Currently giving this a go in swift.

How do I go about getting the core data added into the app delegate file? When I go to create a new tabbed application there is no option to get it added. I notice you can turn core data on in other project templates but not this one?

The easiest way to do so is just creating a new application with Core Data enabled, copy and paste the code from AppDelegate.swift and create a new Core Data Model ( Cmd + N > iOS - Core Data > Data Model ). The only thing you have to do is replace the database name from your demo project with the name you chose for the Core Data Model you created. To do so, just search for your old project name in the code you pasted and replace it with the name of your new Core Data Model.

I also tested what you said and the missing Core Data checkbox for tabbed applications should be an Xcode 6 bug but it does not really matter which template you choose for the application. The Core Data code is the same across all the templates, the only difference between these options is the interface that is generated by Xcode.

Have a look at the framework in the Apple Developer Documentation - Core Data > Topics > First Steps. It's excellent and you can copy and paste the code. Here's the link: https://developer.apple.com/documentation/coredata

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM