Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.