November 2018
Intermediate to advanced
404 pages
10h 16m
English
Unlike the website application, which does not have any need to retrieve an individual journal entry, your web service is required to add such method to the API. This is because in some clients, such as the iOS mobile app, it is difficult to fit the title and content of all journal entries on a small screen. The user is expected to select one item at a time from a list of entries and then view the content of the selected item on a separate screen.
To retrieve a specific item, use the find() method to search for the item by its ID:
// retrieve an item by ID and return itfunc getItemHandler(id: Int, completion: @escaping(JournalItem?, RequestError?) -> Void) { JournalItem.find(id: id) { item, error in guard let ...Read now
Unlock full access