As promised, here is the first update as to how I’m getting on with the project. Naturally, on finishing my exams, I needed a wee break and then a chance to get back into iOS again by finishing watching (and then re-watching) the excellent Stanford University iOS lectures by Paul Hegarty. I properly started development on Monday last week and so far I’m not doing too badly. Obviously it takes a wee bit of time to get back into things but I feel like this week should be productive after a slightly slow first week.
The first thing I did was set up my project with all the appropriate frameworks to get started by using CocoaPods (a decent library manager for Objective-C). I decided to use the MapBox SDK to deal with the maps side of things (allows offline maps which could be useful). Once all the basic setup was done I set about displaying a simple map view and getting the user’s location to be displayed. Next up was creating a table view with the intention of displaying a list of buildings. This involved not only populating a CoreData database with building information, but actually finding the data in the first place. While my contacts at the university have said I will have access to their Oracle database, actually getting hold of the right person to give me the appropriate privileges is like drawing blood from a stone! Thankfully I received an excel file with some basic information about rooms, buildings, schools etc. I managed to populate a CoreData model with some test data by exporting this information as CSV files, converting to JSON (the likely format of the data once I get a web service up and going) and parsing it all into the model with a separate command-line app.
Next up was using an NSFetchedResultsController which nicely manages CoreData fetch requests for display in a table view. This involves pretty much copying, pasting and customising code straight from the documentation into a tableViewController, but for now I decided to just subclass Paul Hegarty’s CoreDataTableViewController as it does what I need. I’ll have to customise this quite a bit in the future, but for now it saved me some time getting things up and running. Finally, just to make the table view a little more friendly, I added alphabetical sections with a wee jump list as well as a search function.
Most of the time this week was spent getting to grips with CoreData and making sure all the right file paths etc were being used in the main. Also, I’ll admit, the process of populating the model from a separate app was a little hacky and even involved some copying and pasting of an SQLLite file :-S. But it works for now, and the long term solution won’t need such a process anyway.
Next up: displaying detail about the buildings, viewing room data and viewing building locations on the map. Also might consider using a tabBar instead of a navigationBar…