Simplify sharing item subject logic
This commit is contained in:
parent
5a5a66d59f
commit
9214e3d65e
@ -17,22 +17,12 @@ import AppKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sharingService(_ sharingService: NSSharingService, willShareItems items: [Any]) {
|
func sharingService(_ sharingService: NSSharingService, willShareItems items: [Any]) {
|
||||||
|
sharingService.subject = items
|
||||||
var subject = ""
|
.compactMap { item in
|
||||||
|
let writer = item as? ArticlePasteboardWriter
|
||||||
for (index, item) in items.enumerated() {
|
return writer?.article.title
|
||||||
|
|
||||||
guard let writer = item as? ArticlePasteboardWriter,
|
|
||||||
let title = writer.article.title else {
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
.joined(separator: ", ")
|
||||||
subject += index != 0 ? ", \(title)" : title
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sharingService.subject = subject
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func sharingService(_ sharingService: NSSharingService, sourceWindowForShareItems items: [Any], sharingContentScope: UnsafeMutablePointer<NSSharingService.SharingContentScope>) -> NSWindow? {
|
func sharingService(_ sharingService: NSSharingService, sourceWindowForShareItems items: [Any], sharingContentScope: UnsafeMutablePointer<NSSharingService.SharingContentScope>) -> NSWindow? {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user