[Swift][Error] Can’t convert value of type * to expected argument type *
公開日: 2016年08月02日
・エラーメッセージ Can’t convert value of type * to expected argument type *
・エラー例
var y:Double
var x:Int = 10
y = 10 + x
// => Can’t convert value of type ‘Int’ to expected argument type ‘Double’
・原因 上記の場合、Double型の変数にInt型の数値を格納しようとしたため
・対策 代入前に型の変換を行う
var y:Double
var x:Int = 10
y = Double(10 + x)