Skip to Content
Learning Cocoa with Objective-C, 4th Edition
book

Learning Cocoa with Objective-C, 4th Edition

by Paris Buttfield-Addison, Jonathon Manning, Tim Nugent
February 2014
Beginner
388 pages
9h 52m
English
O'Reilly Media, Inc.
Content preview from Learning Cocoa with Objective-C, 4th Edition

Chapter 9. Model Objects and Data Storage

Unless your application is a trivial one, it will need to work with data at some point. This data could be as simple as a list of high scores that the user has achieved, or as complex as a multimedia document like a presentation.

This information needs to be accessible to other parts of your application, such as the controller objects, so that work can be done on it. The information needs to be stored somewhere—either in memory, on disk, or on the network.

OS X and iOS provide tools for storing information on disk and on the network. One of the more recent additions to the APIs available to developers is iCloud, a network-based storage system that is designed to allow users to keep the same information on all their devices, without having to do any work to enable this.

Additionally, Cocoa is designed to make the connection between the model, the view, and the controller as flexible as possible, while at the same time reducing the amount of code that you need to write. To this end, Cocoa uses features called key-value coding, which allows you to refer to properties of objects by name rather than by hardcoding method calls, and key-value observing, which allows you to have an object be notified when another object changes the value of one of its properties.

In this chapter, you will learn how key-value coding and key-value observing work, why they’re useful, and how to use them in your code. You will also learn how to work with the filesystem ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learning Cocoa

Learning Cocoa

Jonathon Manning, Tim Nugent, Paris Buttfield-Addison
Learning Cocoa

Learning Cocoa

Apple Computer Inc
Cocoa in a Nutshell

Cocoa in a Nutshell

Michael Beam, James Duncan Davidson

Publisher Resources

ISBN: 9781491901380Errata