Database Reference
In-Depth Information
@NSManaged var department: String
@NSManaged var email: String
@NSManaged var guid: String
@NSManaged var name: String
@NSManaged var phone: String
@NSManaged var pictureThumbnail: NSData
@NSManaged var picture: EmployeeDirectory . EmployeePicture
@NSManaged var vacationDays: NSNumber
@NSManaged var sales : NSSet
}
Next, you need to update the rest of the app to make use of the new entities and
attributes.
Open EmployeeListViewController.swift and find the following lines of code in
tableView(_:cellForRowAtIndexPath:) . It should be easy to find, as it will have an
error marker next to it!
cell.pictureImageView.image = UIImage (data: employee.picture)
This code sets the picture on the cell in the employee list. Now that the full picture
is held in a separate entity, you should use the newly added pictureThumbnail
attribute. Update the file to match the following code:
cell. pictureImageView . image =
UIImage (data: employee. pictureThumbnail )
Now open EmployeeDetailViewController.swift and find the following code
within configureView() . Again, it should be showing an error:
if let imageView = headShotImageView {
let image = UIImage (data: employee.picture)
imageView.image = image
}
Just like you did in EmployeeListViewController.swift, you need to update the
picture being set. Like the cell picture, the employee detail view will only have a
small picture and therefore only needs the thumbnail version. Update the code to
look like the following:
if let imageView = headShotImageView {
let image = UIImage (data: employee. pictureThumbnail )
imageView. image = image
}
Open EmployeePictureViewController.swift and find the following code in
configureView() :
Search WWH ::




Custom Search