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
Swift 2 Blueprints

You're reading from   Swift 2 Blueprints Swift Blueprints

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher Packt
ISBN-13 9781783980765
Length 276 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Cecil Costa Cecil Costa
Author Profile Icon Cecil Costa
Cecil Costa
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Exploring Xcode FREE CHAPTER 2. Creating a City Information App with Customized Table Views 3. Creating a Photo Sharing App 4. Simulating Home Automation with HomeKit 5. Health Analyzing App Using HealthKit 6. Creating a Game App Using SpriteKit 7. Creating an Apple Watch App 8. AVFoundation Index

Storing some asset information


Before we start with the scenes, we must create a class that will store some information about the files that are being used for our media edition. Add a new Swift file to our project and call it AssetInfo.swift. Start importing UIKit, as it is shown in the next line, because we are going to use the UIImage class:

import UIKit

Open the class by calling it AssetInfo; it won't inherit from any specific class or implement any protocol. So, its header must be simple, as follows:

class AssetInfo {

Now, we can start with the first attribute, that is the video thumbnail image. Add the following attribute to your class:

    var videoThumbnail:UIImage?

Besides the video thumbnail, we also need to store the video date and its corresponding URL. Both the attributes are mandatory as the date will be some kind of title and, without the video URL, we won't be able to open it. Place the following attributes and the initializer in your AssetInfo class:

    var videoDate:String
 ...
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 $19.99/month. Cancel anytime