无法从 collectionView 传递索引路径(进入 LightBox 包)

Cannot pass indexpath from collectionView (into LightBox package )

我安装了这个包https://github.com/hyperoslo/Lightbox,但我不知道如何传递我的 collectionView 的索引来显示所需的图片,而不是第一个

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    let controller = LightboxController(images: imagess)
    controller.pageDelegate = self as? LightboxControllerPageDelegate
    controller.dismissalDelegate = self as? LightboxControllerDismissalDelegate
    controller.dynamicBackground = true
    present(controller, animated: true, completion: nil)
}

在这种情况下,我可以更换图片,但第一张总是出现

我似乎已经阅读了所有内容,但我没有找到这个重要的细节。

如果我这样做:

let controller = LightboxController(images: [imagess[indexPath.row]])

我只能查看一张具有所需索引的图片,但无法更改图库中的图片

求助:-)

您必须设置开始索引才能看到当前图像;

所以试试这个;

let controller = LightboxController(images: imagess, startIndex:indexPath.row)