Trying to update a field in ObservedRealmObject that depends on an Enum

Oh - try this. Move the Realm PersisstableEnum outside of the class and move it to the top level of your hierarchy, like the rest of your Realm Models:

import SwiftUI
import RealmSwift

enum ItemStatus: Int, PersistableEnum, CaseIterable {
    case na,recorded,ip,closed

    var text:String{
        switch self{
        case .na:
            return "N/A"
        case .recorded:
            return "Recorded"
        case .ip:
            return "IP"
        case .closed:
            return "Closed"
        }
    }
}

final class InspItem : Object, ObjectKeyIdentifiable {
    @Persisted(primaryKey: true) var _id: ObjectId
1 Like