-1

I used cocoa pods to install DynamicColor and SnappingStepper. How do I fix the compiler error on the "let stepper" line.

Error: Argument labels'(:,:,:,:)' do not match any available overloads When I post this error, the underscore character is not displayed but the _character should be in front of each colon.

import UIKit
import DynamicColor
import SnappingStepper


class ViewController: UIViewController {



let stepper = SnappingStepper(frame: CGRect (0, 0, 100, 40))

func stepperValueChangedAction(sender: AnyObject) {

}

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    stepper.addTarget(self, action: "stepperValueChangedAction:", forControlEvents: .ValueChanged)

    view.addSubview(stepper)

}
ot1
  • 41
  • 1
  • 1
  • 8

1 Answers1

2

Like this:

let stepper = SnappingStepper(frame: CGRect (x:0, y:0, width:100, height:40))

[After you've fixed that, your code will still have numerous problems; but that answers the particular question you asked.)

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • But see also my answer here: http://stackoverflow.com/a/38361239/341994 – matt Jan 22 '17 at 02:17
  • Yes there were 5 or 6 more errors after I corrected the 'let' line. I got them all fixed and it compiles and runs in the Sim. – ot1 Jan 22 '17 at 03:17
  • Cool! But do see the other answer I pointed you to: I think you _should_ be able to say `CGRect (0, 0, 100, 40)` and I provide code that allows you to do so. – matt Jan 22 '17 at 03:23
  • Thank you for your help, I originally copied the "Usage" from the Git site, it had several errors that I corrected before I even posted here. I have all the errors fixed now and it compiles and runs in the Sim. Would you know how to place a Snapping Stepper component on the storyboard??? – ot1 Jan 22 '17 at 03:34
  • Well I added the extension CGRect immediately below the import SnappingStepper, and eliminated the x: y: Width: height: on my 'let' line. It compiled and ran. However I also did an Edit/Convert/To Current Swift Syntax as suggested by one of the posters to that link and now I have 28 errors!!!!! Was that a mistake? – ot1 Jan 22 '17 at 04:01
  • No, I don't think so. The errors are probably not real. If it compiles, it compiles and that's that! – matt Jan 22 '17 at 04:04
  • Since I'm a newbie here, I can only ask a question every 4 or 5 days. Its a lot of wasted time. – ot1 Jan 22 '17 at 04:09
  • I did a Product/Clean and all but two of the errors left, the two remaining were fixed by removing a semicolon were it didn't belong. Now it compiles and runs. And now the waiting game to post the "leeched" question. Thanks again for your help Matt! – ot1 Jan 22 '17 at 04:18