Lightbox
Lightbox copied to clipboard
Delete image
Step 1 - enable delete button:
LightboxConfig.DeleteButton.enabled = true
Step 2 - Delete:
Crash on:
let pageView = pageViews[i]
in:
func reconfigurePagesForPreload() {
let preloadIndicies = calculatePreloadIndicies()
for i in 0..<initialImages.count {
let pageView = pageViews[i]
if preloadIndicies.contains(i) {
if type(of: pageView.image) == LightboxImageStub.self {
pageView.update(with: initialImages[i])
}
} else {
if type(of: pageView.image) != LightboxImageStub.self {
pageView.update(with: LightboxImageStub())
}
}
}
}
Fixed by adding the following line:
self.initialImages.remove(at: prevIndex)
to func headerView(_ headerView: HeaderView, didPressDeleteButton deleteButton: UIButton) {
noting the above function is also lacking a delegate
This fix is already in this pull request - https://github.com/hyperoslo/Lightbox/pull/265 I think the repo maintainer just have to release new version.
Ok! New version coming