func dropShape() {
if let shape = fallingShape {
while detectIllegalPlacement() == false {
shape.lowerShapeByOneRow()
}
shape.raiseShapeByOneRow()
delegate?.gameShapeDidDrop(self)
}
}
Hi, I'm taking this Invalid redeclaration of 'dropShape()' so what did I wrong. Can anybody help me
That error message means that you have created two functions with the same name.
You can not use same name and same signature for function. Yes function overloading is there and it means that you can use same name with different parameters. You can create as many function as you want using same name. The thumb rule is each overloading function must have different parameters.
For Example:
func dropShape() {
}
func dropShape(points: CGPoint) {
}
I had the same issue, I've solved it by deleting an extra file in the compile sources.
That should solve your problem.
I had this exact error message just right now. For me it was a class and a struct conflict.
For any two declaration of types in the same scope, you will get an error e.g. if you use any of declare any of the 2 types below, you will get an error
class employee{...}
struct employee{...}
func employee(){...}
protocol employee{...}
It's not just for classes, structs or func, it's for everything because func
s, struct
s, enum
s, protocol
s are all First class citizens in Swift
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With