SwiftData update value

Hi

I want to update item value after insert.

Solution(False): I want to add "isAutosaveEnabled" prop to modelContainer, but modelContainer just have one parm.

Solution2(False): There doesn't have API to update SwiftData, I just find insert, delete and save. I change the city_name and run "try? modelContext.save()". But it replace after I reopen the app and maybe it doesn't work even before I close app.

How can I update the city_name?

/// --------- App ---------
import SwiftUI
import SwiftData

@main
struct MyApp: App {
    
    var container: ModelContainer
    init(){
        let schema = Schema([    
            SD_City.self,
        ])
        
        let modelConfiguration = ModelConfiguration(schema: schema)
        
        do {
            container = try ModelContainer(for: schema, configurations: [modelConfiguration])
            let context = ModelContext(container)
            
            var city : SD_City
            
            city = SD_City(city_id: 1, city_name: "city1")
            context.insert(city)
            city = SD_City(city_id: 2, city_name: "city2")
            context.insert(city)
            
        } catch {
            fatalError("Could not create ModelContainer: ")
        }
    }
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
        .modelContainer(container)
    }
}

/// --------- ContentView ---------
import SwiftUI
import SwiftData
struct ContentView: View {
    @Environment(\.modelContext) private var modelContext
    
    @State var sortOrder_city = SortDescriptor(\SD_City.city_id)
    @Query(sort: [SortDescriptor(\SD_City.city_id)]) var citylist: [SD_City]
    
    @State var city_id = 0
    @State var city_name = "city_name"
        
    var body: some View {
        HStack {            
            Button("Change \ncity name", action: {
                // Update the city_name of city1 to city3 
                // SD_City(city_id: 1, city_name: "city1") --> SD_City(city_id: 1, city_name: "city3")
                
            })
            
            Text(city_name)
        }
    }
}

/// ---------swiftdata---------
import SwiftUI
import SwiftData
@Model
final class SD_City{
    @Attribute(.unique) let city_id: Int = 1
    var city_name: String = ""
    
    init(city_id: Int , city_name: String) {
        self.city_id = city_id
        self.city_name = city_name
    }
}

Thanks~

SwiftData update value
 
 
Q