ios sqlite api documentation - ios

I'm currently learning ios core data and I understand that core data is based on sqlite.
I can find documentations on core data at apple's developer, but there seem to be no documentation on sqlite. However, sqlite does have its own website and documentation.
I was wondering, does ios has its own sqlite documentation? Or everything at https://www.sqlite.org/docs.html is applicable to ios sqlite?

Yes, the http://sqlite.org/cintro.html and http://sqlite.org/c3ref/funclist.html documentation works for Swift. See https://stackoverflow.com/a/28642293/1271826 for example of how you can do it. But you might want to find a nice Swift SQLite wrapper class to get you out of the weeds of SQLite's C API (as well as avoiding pitfalls of leaking because you didn't follow the excruciatingly detailed steps required by SQLite's C API).
That having been said, if you're using CoreData, I'd encourage you to stick with the CoreData API, and not dip into SQLite's C API. But, if you want bypass CoreData entirely and only interact directly with SQLite, you can do it like suggested above. But I might suggest really sticking with CoreData unless you have a compelling reason not to.

Everything at sqlite.org/docs.html is applicable in iOS SqLite ...because Core Data is only for iOS but SqLite is available for many platforms ..

Related

Xcode 8/Swift 3: make API information available offline? [duplicate]

This question already has an answer here:
How to make offline database for my app?
(1 answer)
Closed 6 years ago.
I'm currently working on an application in Xcode 8/Swift 3 which runs through APIs. Essentially, I'm parsing information using SwiftyJSON from my MySQL database which keeps the content current and easily updated.
To keep it so the content is also available offline, I'd like to introduce a facility where the data is downloaded and stored on the phone so it is available in "offline mode".
I know it's a completely open question but can anyone point me in the correct direction of how I could make this JSON information available offline? I've tried searching the net with no success.
I know it's not Swift, but the absolute master of this has recently open sauced his master piece: Dash for iOS.
Reviewing what he's done to get rapid scrolling and searches might give some deep insight into how to best do this as done by someone with (arguably) more experience in this area than anyone other than Apple:
https://github.com/Kapeli/Dash-iOS
I will prefer here 2 option either I will go with 1.SQLite DB or 2. NSURLCache
For SQLite DB you can use FMDB wrapper-https://github.com/ccgus/fmdb
For NSURLCache check this link Best way to Cache JSON from API in SWIFT?
If you just want to save json then go with NSURLCache for offline mode.
Achieving offline for iOS is having two best paths they are CoreData and SQLITE. As per the definition of CoreData suggests it is a Model layer of the project. It comes with less efforts on developer side. Bit contrast SQLITE having the same way but little efforts on it.
In my project we are using the CoreData for offline maintenance. Really we have few concerns on the Relational data fetching, Although there is a Predicates representing CoreData for the same still it is limited to some part. These type of situations SQLITE is really a life saver. We can easily fetch the records with simple JOIN commands.
Conclusion:
If you have more complex data relations it's really better to go with the SQLITE, Apart from CoreData is best choice.

Developing Quiz App - Data Storage iOS

I am planning to develop a quiz app in iOS and doing it offline. I need to store 100s of questions and options in that app. How to store? How does core data comes in handy here? Is there any other good methods for this problem?
The app is meant to be offline.
You can also use SQLite database for saving Questions and Answers offline for your Quiz app. You can create tables in SQLite and save and fetch data from that using SQLite queries.
I would recommend you to use realm.io. It measures better than core data, its fast and simple to use. On https://realm.io there is lots of documentation.
I find realm much easier to set up and in generally to comprehend. It works nicely with SwiftJSON and hence in my view much easier to connect to backend.
Preloading core data can be quite cumbersome and to me it seems that core data still relies heavily on objective c.
On the other Core Data is made by Apple so it could be more stable solution on longer run (parse.com)

Information about API's, Core data iOS design from the start

Good Morning,
I am in the process of designing an app. It will capture data in the device and will sync with a web server, I have a few months learning Swift to develope iOS apps and I am learning to use core data now with small samples.
I have a book I've been reading and available resources like this one:
https://developer.apple.com/library/watchos/documentation/Cocoa/Conceptual/CoreData/index.html
My question is:
Do I have to start learning how to sync and save data in the device at the same time? or I can learn Core Data first, make the app and then start the process of syncing (using JSON)?
What available resources can I see to learn what I need?
This is new for me, I have a friend who knows Ruby and has knowledge about API, but he does not know how mobile devices works in this matter.
I have searched here, but a lot of question and answers I see covers specific topics.
Your help and time is really appreciated. Thanks!
P.S.
I apologize for the term sync (send and receive data to/from the server) if I a using it wrong, or should I use the term API? For me is a little confusing on how to use the term, since it is use for a few things, like data, but also it's used when talking about a method which all the info you need to go to the API of the method, function or class.
The process you should follow is first learn basic iOS developemeet. Check out the tutorials at raywenderlich and hacking with swift. In the process you will learn a bit about networking(working with APIs) and Data Persistence(Core Data).
Since collection of data precedes storage of data you must learn first about REST APIs, JSON, JSON parsing and related stuff, third party libraries available like Alamofire and SwiftyJSON(these can be installed using cocoapods)
And then jump into data persistence which can be done through sqlite database(FMDB is a wrapper available and is super easy), Core Data, NSUserDefaults, plist, Realm etc.

How can I get Core Data in a project that did't check the 'use Core Data' option at start up? [duplicate]

This question already has an answer here:
Implement CoreData into an existing project using Swift
(1 answer)
Closed 7 years ago.
When I created my project, I'm new in iOS development, so I did't check the use Core Data option, but now I need to use Core Data in my project and I've already put a lot of work on the project so I can't start all over again. So anyone knows how to get those files like coredata.xcdatamodeld?
I don't know the exact solution to just adding Core Data to a project without Core Data but instead of using Core Data use SQLite. It can be implemented to your project
Let’s take a look at using SQLite directly.
Relational Database System
Potential for cross platform compatibility
Many early iPhone database examples were written using SQLite
Objective-C wrappers such as FMDB are pretty easy to use
Now at Core Data:
Can store data in it’s own Binary, or SQLite storage format.
Can serialize objects – Much higher level than using SQLite
directly
Not a RDBMS you could actually just store things directly.

Is possible to have a custom SQLite build for Core Data?

SQLite reportedly became much faster compared to older versions, performance gain is said to be 50%! (source: 50% faster than 3.7.17).
For Core Data, Apple uses 3.7.13 from June 2012, so I am wondering if it is possible to bundle a custom build of SQLite and tell Core Data to use it?
I know that is possible for jailbroken devices, but I'm looking for a solution for App Store apps.
Not 100 percent certain of all the details but it looks like that as long as you can statically compile and link the latest version of SQLite, that you could then use NSIncrementalStore as a bridge between your SQL backend and Core Data.
This is the best introduction to NSIncrementalStore I have found http://nshipster.com/nsincrementalstore/

Resources