Skip to content

Commit

Permalink
Merge pull request #4 from nick1ee/codereview
Browse files Browse the repository at this point in the history
confirmed
  • Loading branch information
nick1ee authored Aug 4, 2017
2 parents 9d49eff + 3ad111d commit 38f4327
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Journal/Controller/JournalViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class JournalViewController: UIViewController {

if self.receivedJournal != nil {

guard let data = receivedJournal?.imageData as? Data else { return }
guard let data = receivedJournal?.imageData else { return }

uploadImageView.image = UIImage(data: data)

Expand Down
4 changes: 2 additions & 2 deletions Journal/Extension/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ extension JournalViewController {
inputContent.text != "" {

guard
let imageData = UIImagePNGRepresentation(uploadImageView.image!) as? NSData,
let data = UIImageJPEGRepresentation(uploadImageView.image!, 1),
let title = inputTitle.text,
let content = inputContent.text else { return }

let timeToInteger = Int(Date().timeIntervalSince1970 * 1000.0)
let timestamp = String(timeToInteger)

let journal = Journal.init(imageData: imageData, title: title, content: content, timeStamp: timestamp)
let journal = Journal.init(imageData: data, title: title, content: content, timeStamp: timestamp)

CoreDataProvider().saveJournal(withJournal: journal)

Expand Down
6 changes: 3 additions & 3 deletions Journal/Structure/Journal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

struct Journal {

var imageData: NSData
var imageData: Data

var title: String

Expand Down Expand Up @@ -48,13 +48,13 @@ extension Journal {

}

guard let imageData = journal.imageData else {
guard let data = journal.imageData else {

throw FetchJournalError.missingImageData

}

self.imageData = imageData
self.imageData = data as Data

guard let title = journal.title else {

Expand Down

0 comments on commit 38f4327

Please sign in to comment.