Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Intermediate Swift 2 Properties Computed Properties

Brian Uribe
Brian Uribe
3,488 Points

[SOLVED] use of unresolved identifier "centerValue" Why am I getting this error?

Here is my code

struct Rectange2 { // [MOD: Rectangle?]
    var origin = Point2()
    var size = Size()

    var center: Point2 {
        get{
            let centerX = origin.x + size.width/2
            let centerY = origin.y + size.height/2

            return Point2(x: centerX, y: centerY)
        }

        set(centerVaue){ // [MOD: centerValue?]
            origin.x = centerValue.x - size.width/2 //Unresolved identifier
            origin.y = centerValue.y - size.heigt/2 //Unresolved identifier [MOD: height?]
        }  
    }
}
Brian Uribe
Brian Uribe
3,488 Points

It was a typo. Nevermind!

Glad you got it fixed - there's a few typos in that code. I added some comments.

Shout if you need help with any other challenges etc. Lots of people in the Community here to help. :+1:

Steve.