0

I am using SnapKit and I am trying to pass the closure as a param to my function which calls snp_makeConstaints like below,

func drawView(view: UIView, callback: (() -> Void)!) {
    self.addSubview(view)
    view.snp_makeConstraints(closure: callback)
}

I am getting the following error,

../example.swift:57:43: Cannot convert value of type '(() -> Void)!' to expected argument type '@noescape (make: ConstraintMaker) -> Void'

Therefore I added (make: ConstaintMaker) -> Void

which resulted in the following error, Use of undeclared type 'ConstraintMaker'

I do not understand what @noescape is and why it is saying that ConstraintMaker is undeclared.

Nagendra Rao
  • 7,016
  • 5
  • 54
  • 92

1 Answers1

0

Add import SnapKit on the top of the swift file where you have the problem.

sliwinski.lukas
  • 1,412
  • 1
  • 18
  • 28