Diary App

A diary app created for Treehouse iOS Techdegree Unit 8.

In addition to writing diary entries, you can add photos, and save your current location. Uses CoreData to store all of the entries.

Technical Background
Saving Posts

This app relied heavily on Core Data. A Post entity was created which has attributes for:

  • date the post was created
  • message
  • mood
  • optional location name

Users can also attach photos to their posts, so the Post entity has a one to many relationship with Photo entities. These store images as binary data and "Allows External Storage" turned on. When new images are added, they are resized to full size and thumbnail size. This is because the photos that come from a phone can possibly have a very large resoution, so it's scaled down to take up less space on the device.


Diary App – Post


The app also has the feature to get the user's current location for a post. This is accomplished with Core Location using CLLocationManager and CLGeocoder to reverse geocode the GPS coordinates of the current location.



The starting view controller is a UITableViewController that uses NSFetchedResultsController to fetch the table data from the Core Data database. The NSFetchedResultsController is also very useful for showing search results by setting its fetchRequest.predicate to only return Posts with messages containing a search string. This search string is updated whenever the user starts typing in the search bar at the top which is a UISearchController.

Diary App – Table