Chapter 18. Modeling Our Library
At this point, we’ve made a fair amount of headway on our library application; we’ve got some basic structural elements in place for the app, we’re transitioning between some screens, and we’re listing out some data. Unfortunately that data is static, hard-coded data—this won’t get us far for very long. In order to move forward with the rest of the app, we need to look at our data model. Paying attention to it now will allow us to make something a bit more maintainable and robust.
Now, static data in and of itself is not a terrible thing. In fact, we’ll continue to use “static” data throughout this tutorial until we talk about networking in Chapter 9. A large part of the problem with the way we’re serving up a list of books right now is that it’s not very portable to other places inside the app.
Right now, we’re only displaying books in a catalog view within the app. Later, however, we’ll be searching for books, saving books, and more. Let’s figure out a way to move forward that is a bit more adaptable for the future.
Dynamic Data in List Views
Our list view of books is a great place to start looking at ways to make our display of data a bit more dynamic. If you’ll recall, the list of books is currently stored as a temporary property on our main object type, Book, as sampleData to make it a bit easier to find and use.
As we add more views that display data to our application, however, we’ll find that this is a bit repetitive and cumbersome to ...