diff --git a/StickerSlack/EmojiHoarder/EmojiHoarder.Packs.swift b/StickerSlack/EmojiHoarder/EmojiHoarder.Packs.swift index 9660887..fbb49f4 100644 --- a/StickerSlack/EmojiHoarder/EmojiHoarder.Packs.swift +++ b/StickerSlack/EmojiHoarder/EmojiHoarder.Packs.swift @@ -69,4 +69,10 @@ extension EmojiHoarder { } saveEmojiPacks() } + + func moveEmojiPack(from: IndexPath, to: IndexPath) { + let removed = emojiPacks.remove(at: from.row) + emojiPacks.insert(removed, at: to.row) + saveEmojiPacks() + } } diff --git a/StickerSlack/UIKit/EmojiPacks/EmojiPackListView.swift b/StickerSlack/UIKit/EmojiPacks/EmojiPackListView.swift index fd736d1..4ba71e2 100644 --- a/StickerSlack/UIKit/EmojiPacks/EmojiPackListView.swift +++ b/StickerSlack/UIKit/EmojiPacks/EmojiPackListView.swift @@ -220,7 +220,7 @@ class EmojiPackListView: UITableViewController { } override func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { - print(tableView, sourceIndexPath, destinationIndexPath) + self.emojiHoarder.moveEmojiPack(from: sourceIndexPath, to: destinationIndexPath) } override func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {