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 trialAnan Almasri
Courses Plus Student 3,221 PointsI need help on object-Oriented Swift 2.0 getfullName()
How to solve this code
struct Person {
let firstName: String
let lastName: String
}
1 Answer
David Papandrew
8,386 PointsHi Anan,
You need to create a method within the struct called getFullName that returns a string with firstName and lastName.
Here is the code for Step 1 if you need help with that. Hopefully that is enough to get you started in the right direction. Step 2 will have you create an instance of Person and then call the getFullName function on that object.
struct Person {
let firstName: String
let lastName: String
func getFullName() -> String {
return "\(firstName) \(lastName)"
}
}
Ravi Soni
iOS Development Techdegree Student 1,123 PointsThank you dear ,
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsThe code included just has the starter code for the challenge... could you include what code you have tried to solve the challenge. This way we can help you troubleshoot.