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

Question about follow-up task

<p>Hello guys,

</p> <p></p> <p>I can't figure out how to correctly assign coordinates for the instance created in the task. At the moment I get an error saying the entry "Double, Double" can't be used for the struct Location. This confuses me, as Location exist out of two Double's?

</p> <p></p> <p>Anyone who can help me out here? Thanks in advance.

</p> <p></p>

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

class Business {
    let name: String
    let location: Location

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

let someBusines = Business(name: "ABC", location: (1121.121,1331.13))

2 Answers

Jeroen,

You will need to create an instance of Location and assign it to the location parameter for Business. Right now you are just setting a tuple of (Double, Double), but it expects an instance of Location.

let someBusines = Business(name: "ABC", location: Location(latitude: 1121.121, longitude: 1331.13))

Florin

Ah that makes sense! Thanks Florin!