Use glyphs from SF Symbols for table row swipe actions

(Thin font weight.)
This commit is contained in:
Nate Weaver 2019-10-22 13:39:15 -05:00
parent c771bd651c
commit 4b1a19360c
11 changed files with 116 additions and 4 deletions

View File

@ -94,4 +94,20 @@ struct AppAssets {
return RSImage(named: NSImage.smartBadgeTemplateName)! return RSImage(named: NSImage.smartBadgeTemplateName)!
}() }()
static var swipeMarkReadImage: RSImage = {
return RSImage(named: "swipeMarkRead")!
}()
static var swipeMarkUnreadImage: RSImage = {
return RSImage(named: "swipeMarkUnread")!
}()
static var swipeMarkStarredImage: RSImage = {
return RSImage(named: "swipeMarkStarred")!
}()
static var swipeMarkUnstarredImage: RSImage = {
return RSImage(named: "swipeMarkUnstarred")!
}()
} }

View File

@ -779,19 +779,19 @@ extension TimelineViewController: NSTableViewDelegate {
switch edge { switch edge {
case .leading: case .leading:
let title = article.status.read ? NSLocalizedString("Mark Unread", comment: "mark unread") : NSLocalizedString("Mark Read", comment: "mark read") let action = NSTableViewRowAction(style: .regular, title: "") { (action, row) in
let action = NSTableViewRowAction(style: .regular, title: title) { (action, row) in
self.toggleArticleRead(article); self.toggleArticleRead(article);
tableView.rowActionsVisible = false tableView.rowActionsVisible = false
} }
action.image = article.status.read ? AppAssets.swipeMarkUnreadImage : AppAssets.swipeMarkReadImage
return [action] return [action]
case .trailing: case .trailing:
let title = article.status.starred ? NSLocalizedString("Mark Unstarred", comment: "mark unstarred") : NSLocalizedString("Mark Starred", comment: "mark starred") let action = NSTableViewRowAction(style: .regular, title: "") { (action, row) in
let action = NSTableViewRowAction(style: .regular, title: title) { (action, row) in
self.toggleArticleStarred(article); self.toggleArticleStarred(article);
tableView.rowActionsVisible = false tableView.rowActionsVisible = false
} }
action.image = article.status.starred ? AppAssets.swipeMarkUnstarredImage : AppAssets.swipeMarkStarredImage
return [action] return [action]
@unknown default: @unknown default:

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,24 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "checkmark.circle.pdf",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "star.fill.pdf",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,24 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "circle.fill.pdf",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "star.pdf",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}