Results 1 to 1 of 1
Thread: Xcode Errors!
-
02-13-2018, 01:14 PM #1
- Member Since
- Feb 13, 2018
- Posts
- 1
- Rep Power
- 0
Xcode Errors!
I am trying to learn XCode by following the Stanford University cs193p course Winter 2017.
I am trying to do the FaceIT exercise lectures 4 & 5.
I mostly get this error: 'Argument passed to call that takes no arguments'.
There are 3 Swift files, they are: FaceView.swift, ViewController.swift and FacialExpression.swift.
I am getting the error in 2 files: ViewController and FacialExpression.
Here are the files:
Code:// ViewController.swift // FaceIt // // Created by Tony Hudson on 05/02/2018. // Copyright © 2018 Tony Hudson. All rights reserved. // import UIKit class ViewController: UIViewController { var expression = FacialExpression(eyes: .closed, mouth: .frown) { //Argument passed to call that takes no arguments - hat symbol under ^ closed didSet { updateUI() //Argument passed to call that takes no arguments } } private func updateUI() { switch expression.eyes { case .open: FaceView?.eyesOpen = true case .closed: FaceView?.eyesOpen = false case .squinting: FaceView?.eyesOpen = false } FaceView?.mouthCurvature = mouthCurvatures[expression.mouth] ?? 0.0 } private let mouthCurvatures = [FacialExpression.Mouth.grin:0.5,.frown:-1.0,.smile:1.0,.neutral:0.0,.smirk:-0.5] @IBOutlet weak var FaceView: FaceView! { didSet { let handler = #selector(FaceView.changeScale(byReactingTo:)) let pinchRecognizer = UIPinchGestureRecognizer(target: FaceView, action: handler) FaceView.addGestureRecognizer(pinchRecognizer) let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(toggleEyes(byReactingTo:))) tapRecognizer.numberOfTapsRequired = 1 FaceView.addGestureRecognizer(tapRecognizer) let swipeUpRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(increaseHappiness)) swipeUpRecognizer.direction = .up FaceView.addGestureRecognizer(swipeUpRecognizer) let swipeDownRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(decreaseHappiness)) swipeDownRecognizer.direction = .down FaceView.addGestureRecognizer(swipeDownRecognizer) updateUI() } } func increaseHappiness() { expression = expression.happier } func decreaseHappiness(){ expression = expression.sadder } func toggleEyes(byReactingTo taprecognizer: UITapGestureRecognizer){ if taprecognizer.state == .ended { let eyes: FacialExpression.Eyes = (expression.eyes == .closed) ? .open : .closed expression = FacialExpression(eyes: eyes, mouth: expression.mouth) } } }
Code:// FacialExpression.swift// FaceIt // // Created by Tony Hudson on 08/02/2018. // Copyright © 2018 Tony Hudson. All rights reserved. // import Foundation struct FacialExpression { enum Eyes: Int { case open case closed case squinting } enum Mouth: Int { case frown case smirk case grin case neutral case smile var sadder: Mouth { return Mouth(rawValue: rawValue - 1) ?? .frown } var happier: Mouth { return Mouth(rawValue: rawValue + 1) ?? .smile } } var sadder: FacialExpression { return FacialExpression(eyes: self.eyes, mouth: self.mouth.sadder) } var happier: FacialExpression { return FacialExpression(eyes: self.eyes, mouth: self.mouth.happier) } // FacialExpression.swift // FaceIt // // Created by Tony Hudson on 08/02/2018. // Copyright © 2018 Tony Hudson. All rights reserved. // import Foundation struct FacialExpression { enum Eyes: Int { case open case closed case squinting } enum Mouth: Int { case frown case smirk case grin case neutral case smile var sadder: Mouth { return Mouth(rawValue: rawValue - 1) ?? .frown } var happier: Mouth { return Mouth(rawValue: rawValue + 1) ?? .smile } } var sadder: FacialExpression { return FacialExpression(eyes: self.eyes, mouth: self.mouth.sadder) } var happier: FacialExpression { return FacialExpression(eyes: self.eyes, mouth: self.mouth.happier) } // FacialExpression.swift // FaceIt // // Created by Tony Hudson on 08/02/2018. // Copyright © 2018 Tony Hudson. All rights reserved. // import Foundation struct FacialExpression { enum Eyes: Int { case open case closed case squinting } enum Mouth: Int { case frown case smirk case grin case neutral case smile var sadder: Mouth { return Mouth(rawValue: rawValue - 1) ?? .frown } var happier: Mouth { return Mouth(rawValue: rawValue + 1) ?? .smile } } var sadder: FacialExpression { return FacialExpression(eyes: self.eyes, mouth: self.mouth.sadder) } //Argument passed to call that takes no arguments var happier: FacialExpression { return FacialExpression(eyes: self.eyes, mouth: self.mouth.happier) } //Argument passed to call that takes no arguments let eyes = Eyes let mouth = Mouth //Expected member name or constructor call after type name triangle points to space after Mouth }
I have checked through the code and I can't spot any typos.
Your help would be appreciated.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Keep getting errors in Xcode!!!!!
By miltonian in forum macOS - Development and DarwinReplies: 1Last Post: 04-28-2013, 09:52 AM -
Xcode 4: setting warnings to errors,
By JohnEH in forum macOS - Development and DarwinReplies: 3Last Post: 09-14-2012, 12:53 PM -
Xcode stopped letting me run Xcode app on iPad
By ildsarria in forum iOS DevelopmentReplies: 1Last Post: 11-09-2011, 04:15 PM -
what do these errors mean?
By hownowbrowncow in forum macOS - Operating SystemReplies: 0Last Post: 10-04-2010, 01:39 AM -
C++ Errors
By Ganondor in forum macOS - Development and DarwinReplies: 0Last Post: 04-08-2008, 10:47 PM
-