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 trialEli MBS
1,158 PointsClasses
Would be very happy if someone could help me with this task :)
struct Location {
let latitude: Double
let longitude: Double
}
class Business{
let name: String
let location: Location
init(name: String, location: Double) {
self.name = name; self.location = Location
}
}
let someBusiness = Business(name: "Nespresso", location: 10.5)
Martin Granger
14,521 PointsHi Eli,
You're almost there! It looks like your problem is in your init() method. You've declared location as type "Double" when this should be a struct Location. You'd also need to assign the value of the variable "location" to self.location rather than "Location"
init(name: String, location: Location) {
self.name = name; self.location = location
}
Also,
You'll need to create an instance of Location to pass into the "location" parameter for someBusines instead of a Double value.
let location = Location(latitude:10.0, longitude:23.0 )
let someBusiness = Business(name: "Nespresso", location:location)
I really hope this helps!!!
Kyle Lambert
1,969 PointsKyle Lambert
1,969 PointsHeres the code you're looking for Eli