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 Classes and Objects Classes and Their Methods

Kristof Kocsis
Kristof Kocsis
15,455 Points

Error: (@lvalue Double, @lvalue Double)' is not convertible to 'Double'

Hi guys, I need help with this excercise, because I get an error message at the end and I can't figure out what is the problem. Something Double isn't convertabele to Double, what? When I solve it in xcode it gives me all the numbers no broblem while displaying the same error, I haven't seen this before.

Button.swift
class Button {
  var width: Double
  var height: Double

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

  func incrementBy(points: Double) -> Double { 
 width =  width + points
  height =  height + points
  return (width,height)
  }
}

1 Answer

Kristof Kocsis
Kristof Kocsis
15,455 Points

Never mind, I'm an idiot, I had it return 2 Doubles when only 1 was expected.