I'm implementing a collectionView displaying images, when user selects one of the image, it opens the picture in largeMode.
Now I would need to add a button in the collectionView to let the user either select the view mode (as describe just above) or the select mode where the user can select multiple items for other purpose.

I tried to play with 

> 
> allowsMultipleSelection
> 
> 
> 

when user selects the button but there is no effect.

How can I implement such feature ?

EDIT: adding some sample code

here is what I've tried:

```
    //button select mode
    @IBAction func Selection(_ sender: Any) {
    selectMode = !selectMode
    print("select mode is now: \(selectMode)")
    if(selectMode){
        self.navigationItem.title = "Selection de Photos"
        btnSelect.title = "Voir"
        collectionView.allowsMultipleSelection=true 
    }
    else{
        self.navigationItem.title = "Gallerie"
        btnSelect.title = "Selection"
        collectionView.allowsMultipleSelection=false
    }
}

```

and for the didselectitem

```
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath){
    if collectionView.allowsMultipleSelection{
        print("multi selection mode activated, no preview")
    } else{
            _selectedCells.add(indexPath)
            collectionView.reloadItems(at: [indexPath])
    }
}

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if(!selectMode){
        print("View mode")
        if(segue.identifier as! String == "viewLargePhoto"){
            let controller: ViewPhotoGallerie = segue.destination as! ViewPhotoGallerie
            let indexPath: NSIndexPath = self.collectionView.indexPath(for:sender as! UICollectionViewCell) as! NSIndexPath
            controller.index = indexPath.item
            controller.photosAsset = self.photosAsset
            controller.assetCollection = self.assetCollection
        }
    }
    else{
        print("Select mode")
    }
}

```

but if I'm in select mode (allowsMultipleSelection to false), the preview (segue) is launched and I'm not able to select multiple items.

EDIT2: 

I've updated my code based on allowsMultipleSelection state, the segue to view image in large mode is still opened and then I'm not able to select multiple items. 
here is my code:

```
    @IBAction func Selection(_ sender: Any) {
    selectMode = !selectMode
    print("select mode is now: \(selectMode)")
    if(selectMode){
        btnSelect.title = "Voir"
        collectionView.allowsMultipleSelection=true
    }
    else{
        btnSelect.title = "Selection"
        collectionView.allowsMultipleSelection=false
    }
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

    if(!collectionView.allowsMultipleSelection){
        print("View mode")

        if(segue.identifier as! String == "viewLargePhoto"){
            let controller: ViewPhotoGallerie = segue.destination as! ViewPhotoGallerie
            let indexPath: NSIndexPath = self.collectionView.indexPath(for:sender as! UICollectionViewCell) as! NSIndexPath
            controller.index = indexPath.item
            controller.photosAsset = self.photosAsset
            controller.assetCollection = self.assetCollection
        }
    }
    else{
        print("Select mode")
    }
}

```