Я делаю такое приложение, как Галерея изображений.Конечно, у него есть 2 раздела .. Я имею в виду activeImageGalleries и недавно DeletedImageGalleries
моя ячейка табличного представления может быть переставлена, но я хочу, чтобы она просто переставляла свой раздел, а не другой раздел ... но это не работает
вот мой код:
@IBAction func onEditing(_ sender: Any) {
tableView.isEditing = !tableView.isEditing
}
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
if fromIndexPath.section != to.section {
return
}
if fromIndexPath.section == 0 {
let sourceImageGallery = activeImageGalleries.remove(at: fromIndexPath.row)
activeImageGalleries.insert(sourceImageGallery, at: to.row)
}else {
let sourceImageGallery = recentlyDeletedImageGalleries.remove(at: fromIndexPath.row)
recentlyDeletedImageGalleries.insert(sourceImageGallery, at: to.row)
}
}
кто-нибудь знает, как это исправить?