How to store RawRepresentable, Codable conformant custom type to @SceneStorage?

Trying to save a custom type using @SceneStorage. Here is what I did...please see sample code below
  1. made the custom type RawRepresentable conformant

  2. marked it Codable

Everything seems to work fine...but when the App goes to background...as expected ... block is executed...

var rawValue: RawValue {
.... crashes ....
}

and **JSONEncoder.encode(self). seems to go recursive and crash into a EXCMEMACCESS, code: 2...

Any pointers are deeply appreciated !

Code Block swift
struct AppUIState: RawRepresentable, Codable {
   typealias RawValue = String
   var enteredText: String?
 static let empty = """
                        {
                           "enteredText": ""
                         }
                     """
   init() { }
   init?(rawValue: RawValue) {
        guard let data = rawValue.data(using: .utf8), let result = try? JSONDecoder().decode(AppUIState.self, from: data) else { return nil }
       self = result
   }
  var rawValue: RawValue {
      debugPrint("var rawValue: self: \(self)")
        /* ===== 👇 exc mem access crash after .encode(self) executed... seems to go recursive  ======*/
        guard let data = try? JSONEncoder().encode(self), let stringResult = String(data: data, encoding: .utf8) else { return Self.empty }
       return stringResult
    }
}
/* View */
ContentView: View {
    @SceneStorage("SceneStorage.Keys.appUserState")
    var appUIState = AppUIState()
...
...
...
...
}
code-block


How to store RawRepresentable, Codable conformant custom type to @SceneStorage?
 
 
Q