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

Treehouse has issues with source that works in xCode

Hi All,

Treehouse will not compile the source code below in challenge task 3 of 3 in the "What is Inheritance" section.

If anyone can tell me how to get around this, I would be grateful.

Thanks,

PHIL

Here is the source code:

class Button { var width: Double var height: Double

init(width:Double, height:Double){ self.width = width self.height = height }

func incrementBy(points: Double){ width += points height += points }

}

class RoundButton: Button { var cornerRadius: Double

init(width: Double, height: Double, cornerRadius: Double ) { if cornerRadius > 0.0 { self.cornerRadius = cornerRadius } else { self.cornerRadius = 5.0 }

super.init(width: width, height: height)

}

override func incrementBy(_ points: Double = 7.0){ super.incrementBy(points) } }

var rounded: RoundButton

11 Answers

I don't know what your issue is, but I think you should contact help@teamtreehouse.come.

Here's the complete source. Sorry about miss the 3 back tics on the original.

class Button {
  var width: Double
  var height: Double

  init(width:Double, height:Double){
    self.width = width
    self.height = height
  }

  func incrementBy(points: Double){
    width += points
    height += points
  }


}

class RoundButton: Button {
  var cornerRadius: Double

  init(width: Double, height: Double, cornerRadius: Double ) {
    if cornerRadius > 0.0 {
      self.cornerRadius = cornerRadius
    } else {
      self.cornerRadius = 5.0
    }

    super.init(width: width, height: height)
  }

  override func incrementBy(_ points: Double = 7.0){
    super.incrementBy(points)
  }
}

var rounded: RoundButton

What do you mean by it won't compile it? Are you getting a "cannot communicate" message?

Thank you, Caleb.

It won't successfully compile, and there are no error messages. The output screen only has an HTML tag.

No, there is no "cannot communicate" message.

Is this in a code challenge?

BTW. I love your profile picture :).

Yes, it's a code challenge.

Do you mean that your code is wrong but when you go preview there is no output?

Not exactly. I believe my code is correct, and Treehouse will not accept it. Furthermore, no error message is provided.

Do you get a bummer message or a correct message or something completely different?

I get the bummer message.

What does it say? I don't know Swift so I might not be of much help.

By "it" I assume you mean the bummer message. I just says that my code could not be compiled (yet it works in xCode), and to check the preview screen for the (nonexistent) error message.

Thank you Caleb.