I have to compare a lot of objects. In order to improve speed, I want to make 'id' like the below code. Unfortunately, Swift compiler can't process this code. How can I fix it?
struct OBJ: Identifiable { var i1: UInt var i2: UInt var i3: UInt var i4: UInt var i5: UInt var i6: UInt var i7: UInt var i8: UInt var i9: UInt var i10: UInt var i11: UInt var i12: UInt
var id: UInt32 {
((i1 << 55) + (i2 << 50)) +
((i3 << 45) + (i4 << 40))) +
(((i5 << 35) + (i6 << 30)) +
((i7 << 25) + (i8 << 20))) +
(((i9 << 15) + (i10 << 10)) +
((i11 << 5) + i12
}
I want to make 'id' as UInt by multiple properties. I expected that Swift make a Uint value for 'id' but it failed.