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

Do not know what I'm really supposed to do here!

This is what I've done:

struct Person {
    let firstName: String
    let lastName: String
}

func getFullRemainder() -> {
  return "\(Person)"
}

Please Help!

1 Answer

You should add a method to the struct that returns a string for the full name. This means that that the method should append the last name to the first name. You can do it like this:

func getFullName() -> String {
return "\(firstName) \(lastName)"
}

After that in the second assignment you can instantiate a Person from the struct and assign it to a constant 'aPerson' and call the method to get the full name on it. You can assign the result to a variable 'fullName' like this:

let aPerson = Person(firstName: "Jeroen", lastName: "de Vrind")
let fullName = aPerson.getFullName()

In a playground you can test this and print the fullName with:

print(fullName)