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 Object-Oriented Swift 2.0 Classes Classes with Custom Types

Classes.swift --> Can't figure out this code challenge

Phew... I'm confused. I can not figure out why this isn't working... The error it brings up is "Your class needs to contain the stored properties specified in the directions"

   struct Location {
    let latitude: Double
    let longitude: Double
}



class Business {
    let name: String
    let locatoin: Location

    init(name: String, location: Location) {
        self.name = name
        self.locatoin = location
    }

}
let someBusiness = Business(name: "Not So Lucky", location: Location(latitude: 10.0, longitude: 22.0))

Does anyone have any ideas or can help point me in the right direction? I still don't fully understand init and I assume thats where the problem is - but I can't wrap my brain around it. What am I missing!?!

Thanks!

1 Answer

Nathan Tallack
Nathan Tallack
22,159 Points

You are going to kick yourself. ;)

You spelt location wrong in your stored property and your init. ;)

Wow... Yeah, thats rough. I spent so long trying different things and probably further confusing myself... Lesson learned.

Thanks for taking the time!