-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Moving items in a RealmSwift.List to a higher index results in wrong position after move #7956
Comments
I created a PR which may solve this issue #7960 |
Is this issue linked to other problematic use cases I encountered using List, such as this one which provokes a crash (index out of bound):
In the meantime, replacing the list by an array seems to solve this: |
HI @sonisan are you using one of our property wrappers?, can you please share the code for the View for closer examination?, I may add a test for this to make sure this is fixed or not |
Hello @dianaafanador3, no I am not using Realm's ones for this specific view:
and the list property is:
|
@sonisan And how do you calculate the index to be used in |
@dianaafanador3 Please note that it works with a list containing one element only (crashes if > 1).
|
Hi @sonisan first-able I think your issue is not related to the original issue from the post, which is related to
|
Hi @dianaafanador3 oh.. my apologies then!! Thank you for your suggestion, I will give it a shot! |
How frequently does the bug occur?
All the time
Description
Take this code for demonstration:
We have two model objects, an
MyImage
and anItem
. TheItem
contains a Realm list ofMyImage
's. TheMyView
creates a list with image names that can be moved to another position. When I drag an item to a lower index (e.g. from3
to0
everything is fine. But when I drag it from0
to3
, in the result it is placed at4
.So, every time I drag an item to a higher destination index the result is
draggedDestIndex + 1
(for moving only one item).My dirty quick fix is an override of the
move
function in aBundleCollection
extension.Stacktrace & log output
No response
Can you reproduce the bug?
Yes, always
Reproduction Steps
To reproduce the bug please checkout this sample project and let it run.
Version
10.29.0
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
macOS, iOS
Build environment
Xcode version:
Version 14.0 (14A309)
Dependency manager and version:
SPM
The text was updated successfully, but these errors were encountered: