Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is List<CreamAsset>() legal? #249

Open
Marshall-Hu opened this issue Oct 8, 2021 · 0 comments
Open

is List<CreamAsset>() legal? #249

Marshall-Hu opened this issue Oct 8, 2021 · 0 comments

Comments

@Marshall-Hu
Copy link

Expected behavior

save multi images in List with CreamAsset
code could be like:
let images = List<CreamAsset>()

        if let images = try? self.imagesRelay.value(){
            var cout = 0
            for image in images {
                
                if let imageData = image.jpegData(compressionQuality: 1.0) {
                    tree.images.append(CreamAsset.create(object: tree, propName: TreeCard.AVATAR_KEY + cout.description, data: imageData)!)
                }
                cout += 1
            }
            
            print("NEW tree.images :\(tree.images)")
        }

        try! realm.write {
            realm.add(tree)
        }

Actual behavior(optional)

it seems realm.reslut.images.cout = 0

can someone success add List< CreamAsset > to realmDB? plz point where errors are in my demo code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant