Update addImagesFromFolderURL(_
// presentImage(thumbImage)
presentImage(thumbImage, withFilename: url.lastPathComponent!)
Update presentImage(_
// func presentImage(_ image: NSImage) {
func presentImage(_ image: NSImage, withFilename filename: String) {
. . .
let layer = CALayer()
layer.contents = image
layer.actions = ["position" : positionAnimation, "bounds" : boundsAnimation]
// White Border for image
layer.borderWidth = 5
layer.borderColor = NSColor.white.cgColor
// Shadow for image
layer.shadowOpacity = 0.9 // Need a nonzero value
layer.masksToBounds = false // Allow shadow to be drawn outside bounds (false is default)
layer.shadowColor = NSColor.lightGray.cgColor
layer.shadowOffset = CGSize(width: 10, height: -10) // Appears like with a light source at upper left
// Show filename at lower left
let textLayer = CATextLayer()
textLayer.anchorPoint = CGPoint.zero
textLayer.position = CGPoint(x: layer.borderWidth, y: layer.borderWidth)
textLayer.zPosition = 100
textLayer.fontSize = 15
textLayer.backgroundColor = NSColor.white.cgColor
textLayer.foregroundColor = NSColor.black.cgColor
textLayer.string = filename
let font = NSFont.systemFont(ofSize: textLayer.fontSize)
let attributes = [NSFontAttributeName : font]
var size = filename.size(withAttributes: attributes)
size.width = ceil(size.width)
size.height = ceil(size.height)
textLayer.bounds = CGRect(origin: CGPoint.zero, size: size)
layer.addSublayer(textLayer)