It's not identical to the way you'd get it from IconServices, but you can always try from the filesystem instead:
let url = NSWorkspace.shared.urlForApplication(withBundleIdentifier: "MY.APP.BUNDLE")!
let img = (try? url.resourceValues(forKeys: [.effectiveIconKey]).effectiveIcon) as? NSImage
img?.representations //This is full, but tinted
let bnd = Bundle(url: url)!
let name = bnd.infoDictionary?["CFBundleIconFile"] as? String ?? bnd.infoDictionary?["CFBundleIconName"] as? String ?? ""
let img2 = bnd.image(forResource: name)
img2?.representations //This is smaller but original
Topic:
AppKit
SubTopic:
AppKit Q&A