Giter VIP home page Giter VIP logo

Comments (5)

TheLuckyWan avatar TheLuckyWan commented on August 21, 2024 1

Hi !

Sorry for the late answer. I've implemented your idea, and it's working like a charm. Nice workaround that'll do the trick for now.

I hadn't thought about it.

Thanks for your help. I'll let you close the issue if you want to close it, or leave it open for now.

from unrealm.

arturdev avatar arturdev commented on August 21, 2024

Does the problem exist even if you change SomeArray with String?

from unrealm.

TheLuckyWan avatar TheLuckyWan commented on August 21, 2024

It's working just fine when changing it to a String.

from unrealm.

TheLuckyWan avatar TheLuckyWan commented on August 21, 2024

I'm trying to save an object from another model, inside an array, inside that dictionary.

So basically, this is what i'm trying to achieve:

var dictionary: [Int: [DataModel]] = [:] :

struct DataModel: Realmable, Codable {

}

from unrealm.

arturdev avatar arturdev commented on August 21, 2024

Currently saving an array of objects in a dictionary is not supported.
As a workaround, I can suggest you do the following:

  1. Add a new private variable with type: [Int: String] (say var underlyingDic: [Int: String] = [:]
  2. Add your old variable to the ignored list
  3. In the setter of your old variable convert your array of Codables to json string, and assign to the newly created variable
  4. In the getter of your old variable read the json string form the newly created var and convert it back.

from unrealm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.