Hello. I have protocol witch allow type to handle it's position and function 
who handle this position and compiler get me error. Please, tell, Why I can not 
use protocol name in inout function? The example here.

protocol Position {
     var x:  Double {  get set }
}
 
struct Car:  Position {
     var x:  Double
}
 
func move(item:  inout  Position ) {
    item. x +=  1
}
 
var car =  Car (x:  50 )
 
move (item: & car ) \\  cannot pass immutable value as inout argument: implicit 
conversion from 'Car' to 'Position' requires a temporary


-- 
Седых Александр
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to