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 Complex Data Structures Adding Instance Methods

losing my mind

Given the struct below in the editor, we want to add a method that returns the person’s full name. Declare a method named fullName() that returns a string containing the person’s full name. Note: Make sure to allow for a space between the first and last name Bummer! Make sure your function does not take any parameters and returns a String.

I searched on google how to solve this and the entire first page of google results showed the same way that i approached and yet it still won't approve my answer. I'm so sick of the time I'm wasting on this. I understand treehouse doesn't want to just "give away" the answers but i've spent hours not only trying this every way i know how but even when i research the answer and copy and paste the code from people with the exact same code challenge where they "claim" to have solved it it still gives me an error. treehouse please for the love of whatever you put your hopes into, please just provide the answer so i can see what i did wrong and hey guess what if it turns out the "correct" answer is the same as the one i wrote then i would be less mad because then i would know its just some stupid systematic compiler error and not actually my code.

structs.swift
struct Person {
    let firstName: String
    let lastName: String
  func fullName() -> String{
      return "\(firstName) \(lastName)"
    }

    }
Michael Hulet
Michael Hulet
47,913 Points

I've edited this post to remove the profanity. Treehouse is a family-friendly place, so please refrain from using profanity on the forums

9 Answers

Michael Hulet
Michael Hulet
47,913 Points

Your code appears to accomplish the task. Great job! That being said, the challenge also doesn't pass it for me. I've tried a number of different ways I know should pass, but none of them worked, so I'm gonna go ahead and assume there's a bug in this checker. I've reported it to staff so they can take a closer look

Executable requires at least macOS 10.12, but is being run on macOS 10.11.6, and so is exiting.xcrun: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly! xcrun: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch sh: line 1: xcrun:: command not found

i apologize for the profanity i'll refrain from that moving forward. additionally, this is what the preview said was the result of the error. it does not make sense as i just upgraded to the latest edition of High sierra.

Michael Hulet
Michael Hulet
47,913 Points

It doesn't matter what version of macOS you're using, because when you type code into a Treehouse challenge, it runs on their server, and not your computer. Based on that error message, it sounds like they've updated their version of Xcode and either didn't update their operating system along with it and/or didn't link it properly in their filesystem for their copy of the swift binary to know where to look for it. Either way, it sounds to me like it's going to take a server-side fix on their part before anyone will pass this challenge

ive since move onto the next code challenge at the end of this topic and its giving me the same error.

so i fear this may be happening on all swift related code challenges, quizzes etc.

paul fischer
paul fischer
1,964 Points

I am getting this same error message too.

Executable requires at least macOS 10.12, but is being run on macOS 10.11.6, and so is exiting.xcrun: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly! xcrun: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch sh: line 1: xcrun:: command not found

paul fischer
paul fischer
1,964 Points

I contacted customer support and referenced this discussion.

Paul

Michael Hulet
Michael Hulet
47,913 Points

That's a good move. It seems to me like a server upgrade failed. I wouldn't be surprised if all Swift challenges were broken at the moment. Staff will see both of our messages in the morning, and I'm guessing this'll be a high-priority fix

Rob Allessi
Rob Allessi
8,600 Points

Howdy folks,

Just wanted to let you all know that we're investigating this. In the meantime, I would recommend skipping ahead of this challenge. We'll drop an update in here once we have it straightened out.

paul fischer
paul fischer
1,964 Points

Rob,

Thank you! This probably effects all quizes so we won’t be able to proceed until this issue is resolved.

Paul

Rob Allessi
Rob Allessi
8,600 Points

Update: This should be resolved. Let us know if you're still experiencing any issues!

Michael Hulet
Michael Hulet
47,913 Points

I just tested, and I'm still seeing the same problem

paul fischer
paul fischer
1,964 Points

It worked for me last night. —Paul

Michael Hulet
Michael Hulet
47,913 Points

I just copy/pasted OP's code and it worked. Everything seems to be fixed ?

swift_lint.swift:11:12: error: unexpected non-void return value in void function return "(firstName) (lastName)" ^~~~~~~~~~~~~~~~~~~~~~~~~~ now this is the error thats coming up! but my code is the same as it was before

Michael Hulet
Michael Hulet
47,913 Points

The code in your original posts passes for me with a copy/paste. That error suggests you've removed the -> String part of your function's declaration or changed it to Void. Also, the code you submitted to produce that error is without the backslashes (\) to begin both of the string interpolation escape sequences (\()). It's hard to tell for sure without seeing a copy/paste of your code now, but those 2 problems will need to be fixed for your code to pass