Skip to content

Commit

Permalink
changed swiftyjson git repo to ibm-swift because prev version had bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
eli8527 committed Sep 12, 2016
1 parent 1cd135f commit 6644541
Show file tree
Hide file tree
Showing 5 changed files with 868 additions and 208 deletions.
21 changes: 9 additions & 12 deletions Omarview/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig
let vision = CloudVision(callbackObject: self)

// Base64 encode the image and create the request
let binaryImageData = vision.base64EncodeImage(pickedImage)
let compressedImage = UIImage(data: UIImageJPEGRepresentation(pickedImage, 0.7)!)
let binaryImageData = vision.base64EncodeImage(compressedImage!)

// Create request
vision.createRequest(binaryImageData)
Expand All @@ -142,17 +143,16 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig

}

func scaleUIImageToSize(_ image: UIImage, size: CGSize) -> UIImage {
let hasAlpha = false
let scale: CGFloat = 0.0 // Automatically use scale factor of main screen
func scaleImage(_ image: UIImage, scale: CGFloat) -> UIImage? {
let original = image.size
let newSize = CGSize(width: original.width * scale, height: original.height * scale)

UIGraphicsBeginImageContextWithOptions(size, !hasAlpha, scale)
image.draw(in: CGRect(origin: CGPoint.zero, size: size))

let scaledImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsBeginImageContext(newSize)
image.draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height))
let compressedImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()

return scaledImage!
return compressedImage
}

func eventEditViewController(_ controller: EKEventEditViewController, didCompleteWith action: EKEventEditViewAction){
Expand Down Expand Up @@ -200,7 +200,6 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig

func dataParseCallback(_ dataToParse: Data) {
print("received data and parsing")
print(dataToParse)
LoadingIndicatorView.hide()
// Use SwiftyJSON to parse results
let json = JSON(data: dataToParse)
Expand All @@ -222,7 +221,6 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig
}

let responses: JSON = json["responses"][0]

let textAnnotations: JSON = responses["textAnnotations"]
let numLabels: Int = textAnnotations.count
//var labels: Array<String> = []
Expand All @@ -245,7 +243,6 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig

self.present(alert, animated: true){}
}
//TODO: stub for kelly's function

}

Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ platform :ios, '8.0'
use_frameworks!

target 'CalPal' do
pod 'SwiftyJSON', :git => 'https://github.com/acegreen/SwiftyJSON.git', :branch => 'swift3'
pod 'SwiftyJSON', :git => 'https://github.com/IBM-Swift/SwiftyJSON'
end

post_install do |installer|
Expand Down
90 changes: 47 additions & 43 deletions Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6644541

Please sign in to comment.