I watched some iOS programming tutorial and have a question on "AnyObject". The bridging does not work. I have the following code:
import Foundation
class CalculatorBrain
{
private var accumulator = 0.0
var internalProgram = [AnyObject]()
func setOperand (operand: Double) {
accumulator = operand
internalProgram.append(operand)
}
// ...
}
Same for string...
func performOperation (symbol: String) {
internalProgram.append(symbol)
}
I know about NSString
and the reference type vs. struct thing, and that double and string are no reference types.
But anyway in the tutorial the bridging worked fine...
What could be the reason for my failure?