ios - Dropdown animation in Swift - completion block error -


i following code listed here: dropdown list in swift

namely:

func animatedropdowntoframe(frame: cgrect, completion:() -> void) {     if (!self.isanimating) {         self.isanimating = true         uiview.animatewithduration(0.5, delay: 0.0, options: .curveeaseinout, animations: { () -> void in             self.dropdownview.frame = frame             }, completion: {(completed: bool) -> void in             self.isanimating = false             if (completed) {                 completion()             }             }         )     } } 

and keep getting errors on line completion:

expected ',' separator

expected member name or constructor call after type name

note changed completion line since thought brackets in wrong place, don't think that's issue.

what may issue (and what's best way have debugged on own)?

the syntax, written, pretty hard follow. there may bug swift compiler makes unable parse wrote. swift allows nested functions can this:

func animatedropdowntoframe(frame: cgrect, completion:() -> void) {     func animate() {         self.dropdownview.frame = frame     }      func animationdidcomplete(completed : bool) {         self.isanimating = false         if (completed) {             completion()         }     }      if (!self.isanimating) {         self.isanimating = true         uiview.animatewithduration(0.5, delay: 0.0, options: .curveeaseinout, animations: animate, completion: animationdidcomplete)     } } 

(i have access xcode right there may typos. correct needed)


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -