SWIFTUI - update an Array/property Element gives error (had to replace the Whole structure), not sure my syntax is correct
and Gives Syntax error..
Cannot assign value of type 'Double' to type 'Binding' , snippet of code below
BTW, I was able to use
AllObjects.Replace (but it is process intensive & hanges )
.. replaceSubrange(index...index, with:
[TestObjects(..
latitude:Double(-999.0)
//... etc
)]
Perhaps My syntax has issue .. please help
//code snippets
//declaration
@State private var AllObjects:[TestObjects] = []
func TestObjUpdateLoc(index:Int32) {
AllObjects.TestObjects[index].latitude = Double(-999.0)
**//error ..Cannot assign value of type 'Double' to type 'Binding' **
}
// TestObjects
struct TestObjects: Codable, Hashable {
let seq_id:Int32
let latitude:Double
let longitude:Double
// Many more...
}
Post
Replies
Boosts
Views
Activity
Looking for sample code 3d wireframe (with lines ) & polygons and should be able to rotate (set camera angles)
I tried sample code seems to be complicated & getting a BLANK screen
import SwiftUI
import SceneKit
struct SceneKitTest2: View {
var body: some View {
VStack{
Text("SceneKitTest2")
SceneView(scene: SCNScene(named:"Earth_1_12756.scn"), options: [.autoenablesDefaultLighting,.allowsCameraControl])
.frame(width:UIScreen.main.bounds.width,
height: UIScreen.main.bounds.height/2)
Spacer(minLength: 0)
}
}
}