Skip to content

Commit

Permalink
Updating some of the iOS Examples to match Swift 3 APIs naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
zubco committed Sep 9, 2016
1 parent 394ccbe commit 23263c3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class FilterDisplayViewController: UIViewController, UISplitViewControllerDelega
self.blendImage?.processImage()
currentFilterConfiguration.filter.addTarget(view)
case let .custom(filterSetupFunction:setupFunction):
currentFilterConfiguration.configureCustomFilter(setupFunction(camera:videoCamera, filter:currentFilterConfiguration.filter, outputView:view))
currentFilterConfiguration.configureCustomFilter(setupFunction(videoCamera, currentFilterConfiguration.filter, view))
}

videoCamera.startCapture()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ class FilterListViewController: UITableViewController {

// #pragma mark - Segues

override func prepare(for segue: UIStoryboardSegue, sender: AnyObject?) {
override func prepare(for segue: UIStoryboardSegue, sender: Any?){
if segue.identifier == "showDetail" {
if let indexPath = self.tableView.indexPathForSelectedRow {
let filterInList = filterOperations[(indexPath as NSIndexPath).row]
(segue.destinationViewController as! FilterDisplayViewController).filterOperation = filterInList
(segue.destination as! FilterDisplayViewController).filterOperation = filterInList
}
}

}

// #pragma mark - Table View
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ViewController: UIViewController {

let pngImage = UIImagePNGRepresentation(filteredImage)!
do {
let documentsDir = try FileManager.default.urlForDirectory(.documentDirectory, in:.userDomainMask, appropriateFor:nil, create:true)
let documentsDir = try FileManager.default.url(for:.documentDirectory, in:.userDomainMask, appropriateFor:nil, create:true)
let fileURL = URL(string:"test.png", relativeTo:documentsDir)!
try pngImage.write(to:fileURL, options:.atomic)
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ViewController: UIViewController {
@IBAction func capture(_ sender: AnyObject) {
print("Capture")
do {
let documentsDir = try FileManager.default.urlForDirectory(.documentDirectory, in:.userDomainMask, appropriateFor:nil, create:true)
let documentsDir = try FileManager.default.url(for:.documentDirectory, in:.userDomainMask, appropriateFor:nil, create:true)
saturationFilter.saveNextFrameToURL(URL(string:"TestImage.png", relativeTo:documentsDir)!, format:.png)
} catch {
print("Couldn't save image: \(error)")
Expand Down Expand Up @@ -76,10 +76,10 @@ extension ViewController: CameraDelegate {
func faceLines(_ bounds: CGRect) -> [Line] {
// convert from CoreImage to GL coords
let flip = CGAffineTransform(scaleX: 1, y: -1)
let rotate = flip.rotate(CGFloat(-M_PI_2))
let translate = rotate.translateBy(x: -1, y: -1)
let xform = translate.scaleBy(x: CGFloat(2/fbSize.width), y: CGFloat(2/fbSize.height))
let glRect = bounds.apply(transform: xform)
let rotate = flip.rotated(by: CGFloat(-M_PI_2))
let translate = rotate.translatedBy(x: -1, y: -1)
let xform = translate.scaledBy(x: CGFloat(2/fbSize.width), y: CGFloat(2/fbSize.height))
let glRect = bounds.applying(xform)

let x = Float(glRect.origin.x)
let y = Float(glRect.origin.y)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ViewController: UIViewController {
if (!isRecording) {
do {
self.isRecording = true
let documentsDir = try FileManager.default.urlForDirectory(.documentDirectory, in:.userDomainMask, appropriateFor:nil, create:true)
let documentsDir = try FileManager.default.url(for:.documentDirectory, in:.userDomainMask, appropriateFor:nil, create:true)
let fileURL = URL(string:"test.mp4", relativeTo:documentsDir)!
do {
try FileManager.default.removeItem(at:fileURL)
Expand Down

0 comments on commit 23263c3

Please sign in to comment.