Change explore swipe action titles
This commit is contained in:
parent
1e2947ceba
commit
ed0643c4ad
|
@ -259,20 +259,24 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func trailingSwipeActionsForCell(at indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
private func trailingSwipeActionsForCell(at indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
||||||
|
let title: String
|
||||||
let handler: UIContextualAction.Handler
|
let handler: UIContextualAction.Handler
|
||||||
switch dataSource.itemIdentifier(for: indexPath) {
|
switch dataSource.itemIdentifier(for: indexPath) {
|
||||||
case let .list(list):
|
case let .list(list):
|
||||||
|
title = NSLocalizedString("Delete", comment: "delete swipe action title")
|
||||||
handler = { (_, _, completion) in
|
handler = { (_, _, completion) in
|
||||||
self.deleteList(list, completion: completion)
|
self.deleteList(list, completion: completion)
|
||||||
}
|
}
|
||||||
|
|
||||||
case let .savedHashtag(hashtag):
|
case let .savedHashtag(hashtag):
|
||||||
|
title = NSLocalizedString("Unsave", comment: "unsave swipe action title")
|
||||||
handler = { (_, _, completion) in
|
handler = { (_, _, completion) in
|
||||||
self.removeSavedHashtag(hashtag)
|
self.removeSavedHashtag(hashtag)
|
||||||
completion(true)
|
completion(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
case let .savedInstance(url):
|
case let .savedInstance(url):
|
||||||
|
title = NSLocalizedString("Unsave", comment: "unsave swipe action title")
|
||||||
handler = { (_, _, completion) in
|
handler = { (_, _, completion) in
|
||||||
self.removeSavedInstance(url)
|
self.removeSavedInstance(url)
|
||||||
completion(true)
|
completion(true)
|
||||||
|
@ -283,7 +287,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
return UISwipeActionsConfiguration(actions: [
|
return UISwipeActionsConfiguration(actions: [
|
||||||
UIContextualAction(style: .destructive, title: NSLocalizedString("Delete", comment: "delete swipe action title"), handler: handler)
|
UIContextualAction(style: .destructive, title: title, handler: handler)
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue