Am new to ios application development, but not to application development. Previously i created an android application, a part of it contains an array of elements(say list heading) and its corresponding description (in another array) i didn't have any trouble in retrieving those array elements and using them.
Requirements:
my project is not very complex to use SQLite datastores or Core Data.
i could have the data inside the application variable itself and use them as they are only used at the particular page.
i require a very simple solution to convert my existing data as said arrays.
Problem:
Now i would like to perform the same for ios application too. so i dont want to create the same array like structures redundantly.
Assumptions:
Am assuming tat i could write a script to generate the arrays into an XML File and parse them and use them in my application.
So i need some suggestions and directions on my assumptions.
Related
I've googled for Realm tutorials but I only find examples of how to implement a DB in apps where the user fills the fields (like Contact Apps, To Do apps, etc); they're great, but they do not explain what I want to do.
I'm building a spanish-mayan dictionary app so I don't need that the user enter any data, I only need to display it. I've chosen Realm because it really caught my attention, but I don't seem to find a solution for what I want. Is it possible to create a Realm Object, set its values, populate its data and then display it on a UITableView?
I'm using Swift 2.1.1 and Xcode 7.2
We don't really have any official tools or utilities that can produce pre-made Realm files, but it is something we're actively working on at the moment.
At the moment, the easiest thing (And would ultimately give you the most control) would be to write a small desktop app (Maybe even a command line utility) to import your dictionary data, format it, and then save it out to a Realm file beforehand.
After that, you can simply import the Realm file (and the model classes from the utility app) into your proper app, and you can load the data from there.
I am taking development courses for ios and I was wondering if I wanted to create a translation app would i use a array list to do so? As example code is:-
var dictionary = [“talofa”: “hello’, “faafetai”: “thank you”]
print(dictionary[“talofa”])
it shows up in the logs as “hello” but there has to be an easier way to do translations otherwise I would be fitting a whole language in a array list?
I also read online that people have been using third party services like google to make a translation app but my language is not on google (Hawaiian) what do I do?
First of all, what you are using in your example, in swift/objc it is called a dictionary.
Secondly, for such a huge amount of data, I recommend you use some sort of persistent storage. You can use plain text to store the dictionary (like creating a .plist file), but being iOS I would recommend setting up coredata.
CoreData will allow you to store the information on the device, and access it through a data Model.
Here you can find an example on storing in a file.
Here you can find an example on storing in CoreData.
I personally recommend using coredata for such a large quantity of data. Plist files are more suitable for storing low information quantities (like saving some credentials, some settings, etc).
You need to use DB for this. You can update it from your server when user will have connection, so you don't need to re-submit your app when you will update your vocabulary.
You can use CoreData as #Alex Bartiş told you or you can try another one which becomes popular: Realm
I am working on turning an web app into an iOS app.
They both use the same backend/restAPI.
My question now is: Does core data have any function that makes it possible to pre populate my ios apps "database" ?
I have a few sql files with relational tables (one-to-many) that I would want to get in my app.
Eg, state/city, category/sub-category.
So is there a way to get the data form my sql file into the ios app?
I would want to build/ship the app with the data already there, instead of making an API call and then store the data.
Thanks
Do you really need Core Data? If all you need is access to your relational data, I'd create a SQLite database from your SQL dumps on your PC. Then you can include that file in your app's bundle during the "Copy Resources" step. SQLite is available on iOS, so you'd be good to go.
I'm working on switching an iOS app over from storing data using archiving to accessing XML files on a web service, in order to have one central database for many users. I've found resources explaining how to use NSXMLParser, but very little that explains how to create or edit XML files on the database with information entered into text fields on the app.
The web service is up and running, but the Catch-22 is that I can't verify that my parser works properly without also being able to enter data and having it save to the web service.
The data is pretty basic. For example, I might have a Car object that has a few NSString properties- year, make, model, color, and so on. I need to be able to add and delete Cars, as well as edit the properties. Suggestions?
In terms of reading the data, I recently wrote a simple XML parser for iOS called ConiferXML. You can check it out at GitHub. If this doesn't work out there is also another library on GitHub that is a little more complex but does the same thing.
I want to ask something about iOS .I get the values from xml file after that I parsed and I want to insert database (sqlite).How can I do this.How can I create dynamic tables and columns .Do you have such a structure in objective c .
similar datatable c#.
The Sqlite3 C API is accessible directly (you need to link the build product against libsqlite3 in the link with libraries build phase). You can either write elements to a pre-created sqlite database (if you already know the structure of the data), or store the elements in NSMutableArray/NSMutableDictionary until the XML parsing has ended (provided the XML data isn't too huge to fit sensibly into memory). Then create an appropriate database to store the data.
You can also use core data which is the apple recommended way (and which uses sqlite under the hood), with a nicer object oriented API.
The C API is described in detail here, and it links to specific examples for many different common sqlite operations. There are also objective C wrappers for sqlite like this one if you're uncomfortable with C.
Define an object class with all the relevant fields you find in the XML (title, date, description etc), then iterate through the parsed XML creating a new object for each row. Once the object has been populated, store it in a MutableArray and move onto the next.
You can then pass this structured array to your database, where you can again loop through it and extract the values. You might want to read up on FMDB as it has a lot of useful functions built in to aid this.
Well you can use SQLite with iOS. Better there is Core Data.