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

gallery duplicates image #819

Open
nursedayuksel opened this issue Aug 31, 2024 · 0 comments
Open

gallery duplicates image #819

nursedayuksel opened this issue Aug 31, 2024 · 0 comments

Comments

@nursedayuksel
Copy link

nursedayuksel commented Aug 31, 2024

for example, i'm selecting three images, then i click next. when i go back the images i've pre-selected are still selected, so that's good. however when i click next again the three images get appended to my images array twice, so i end up having two of the same images. same if i go back and click next again, i'll have three of the same images. am i supposed to do something additional? i'm using an if to check if the array contains the same image, but i don't think that's doing anything, so maybe i'm checking the wrong thing?

  `picker.didFinishPicking { [unowned picker] items, cancelled in
        for item in items {
            switch item {
            case .photo(let photo):
                if !selectedImages.contains(photo.image) {
                    selectedImages.append(photo.image)
                }
            case .video(let video):
                if !videoURLs.contains(video.url) {
                    videoURLs.append(video.url)
                }
                print(video.url)
            }
            
            self.preselectedItems.append(item)
        }
        createPostViewModel.showPostPage = true
        
        if cancelled {
            picker.dismiss(animated: true, completion: nil)
            createPostViewModel.showPostPage = false
        }
    }
    return picker`
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