No candidates produce the expected result
<p>I've looked at this <a href="https://stackoverflow.com/questions/36338866/no-candidates-produce-the-expected-contextual-result-type-int">answer</a>, but since I am new to Swift and am following along code that should work from Stanford CS193's course, I'm a bit confused.</p>

<p>This is from an exercise that involves building a calculator. In the model I have these functions:</p>

<pre><code>private func evaluate() -&gt; Double? {
    let (result, remainder) = evaluate(opStack)
    return result
}

func pushOperand(operand: Double) {
    opStack.append(Op.Operand(operand))
    return evaluate()
}

func performOperation(symbol: String) {
    if let operation = knownOps[symbol] {
        opStack.append(operation)
        return evaluate()
    }
}
</code></pre>

<p>In the controller, I have these functions:</p>

<pre><code>@IBAction func operate(sender: UIButton) {
    if userIsInTheMiddleOfTypingANumber {
        enter()
    }
    if let operation = sender.currentTitle {
        if let result = brain.performOperation(operation) {
            displayValue = result
        } else {
            displayValue = 0
        }
    }
}

@IBAction func enter() {
    userIsInTheMiddleOfTypingANumber = false
    if let result = brain.pushOperand(displayValue) {
        displayValue = result
    } else {
        displayValue = 0
    }
}
</code></pre>

<p>Next to the functions pushOperand/performOperation in the model where it says "return evaluate", I get the "no candidates for evaluate produce the expected contextual result type..." and next to the functions operate/Enter in the controller, I get "initializer for conditional type must have optional type..." next to the "let result" lines.</p>

<p>How do I rectify these errors and what is causing them (as the code works in the presentation given)?</p>