Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Xcode 8

You're reading from   Learning Xcode 8 Learn to build iOS Applications with Xcode 8

Arrow left icon
Product type Paperback
Published in Nov 2016
Publisher Packt
ISBN-13 9781785885723
Length 480 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jak Tiano Jak Tiano
Author Profile Icon Jak Tiano
Jak Tiano
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Starting Your iOS Journey FREE CHAPTER 2. Welcome to Xcode 3. Introduction to Swift 3 4. Using Storyboards, Auto Layout, and Size Classes 5. Taking Advantage of Source Control in Xcode 6. Building Your First iOS App 7. Integrating Multitouch and Gestures 8. Exploring Common iOS Frameworks 9. Working with Core Data 10. Creating a watchOS Companion App 11. Advanced Input Using Sensors 12. Sending Notifications 13. Writing Unit Tests 14. Debugging an iOS Application 15. Optimizing Your App 16. Distributing an iOS App Index

Snippet dates


Our last story is a pretty simple one: "I want to see the date a snippet was made". To do this, we're going to have to accomplish the following tasks:

  • Appending our base SnippetData to hold a date

  • When a snippet is created, saving the current date to our data model

  • Adding a UILabel to our prototype cells to hold date information, and assign the text in our view controller

This should be a fairly straightforward feature to add, especially since we set up the rest of our code pretty neatly. Let's get to it.

Update SnippetData model

Current task: Append our base SnippetData to hold a date.

First, let's make a quick update to our data model, in SnippetData.swift. In our base class of SnippetData, we want to add a new property called date, of the type Date. We then also need to update all of our initializers to accept a value for the date, and we then assign that date to our date property. Here is the updated source code for our data model, with the changed lines highlighted:

class SnippetData...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime