Q:

(swift) Error: can not invoke '>' with an argument list of type '(UInt32, @lvalue UInt32)'

class ViewController: UIViewController {

    @IBOutlet weak var inputField: UITextField!
    @IBOutlet weak var output: UITextView!

    var guesses : UInt = 0
    var number : UInt32 = 0
    var gameOver = false
    let MAX_GUESSES : UInt = 8

    @IBAction func guess(sender: UIButton) {
        var possibleGuess : Int? = inputField.text.toInt()

        if let guess = possibleGuess {
            // possibleGuess exists!
        } else {
            consoleOut("Please input a valid number!\n")
            clearInput()
        }

        if UInt32(guess) > Int(number) {
            consoleOut("\(guess): You guessed too high!\n")
            ++guesses
        } else if UInt32(guess) < number {
            consoleOut("\(guess): You guessed too low!\n")
            ++guesses
        } else {
            consoleOut("\n\(guess): You win!\n")
            consoleOut("Go again? (Y)")
            guesses = 0
            gameOver = true
        }
        clearInput()

        if (guesses == MAX_GUESSES) {
            consoleOut("\nYou lose :(\n")
            consoleOut("Go again? (Y)")
            guesses = 0
            gameOver = true
        }

    }

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        number = generateNewNumber()
        consoleOut("Gondolkodom egy számot...\n")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    func consoleOut(text : String) {
        output.text = output.text + text
    }

    func generateNewNumber () -> UInt32 {
        return arc4random_uniform(100)
    }

    func clearInput() {
        inputField.text = ""
    }

}

This is the code that I use and I get the error message at if UInt32(guess) > Int(number) {. I really can't get through this.

(swift) Error: can not invoke '>' with an argument list of type '(UInt32, @lvalue UInt32)'

A:

* This is not exactly your problem, but it may show you a way to get around it :) *
This must be a Swift bug like many others ObjectiveC had.
I'm having the same problem trying to compare an arc4random() number (which is an UInt32 type) with a UInt32() casted string, and I get the same error, which is more outrageous in my case because the two numbers ARE the same type. Which leads me to think that the casting must not be producing the desired result.
I though of creating an auxiliary UIint32 variable and assign it UInt32(theString), butSwift doesn't let you convert a String into UInt32 when defining a variable, so I had to create an auxiliary variable to be converted to Int, and then convert the Int to UInt32 to be able to compare the two numbers:
var theString = "5"
var randomNumber = arc4random() % 10

var UInt32Number = UInt32(theString)
   // => ERROR: "Cannot invoke 'init' with an argument of type '@lvalue String!'
   // (this is where I realized the comparison line could be suffering from the same problem)
if randomNumber == UInt32(theString) { ... }
  // No error here 'cos Swift is supposed to have casted theString into a UInt32
  // ...but surprisingly it prompts an ERROR saying it can't compare a UInt32 with a UInt32 (WTF!)
  // And here's where I go crazy, because watch what happens in the next lines:

var intValue = theString.toInt()
var UInt32Value = UInt32(intValue!) 
if randomNumber == UInt32Value { ... } // => NOW IT WORKS!!

CONCLUSION: Swift is not making the conversion type in the comparison even if it's supposed to. Sometimes it seems to f*** up. Using auxiliary variables with set types can get around the problem.

