Skip to content

Instantly share code, notes, and snippets.

@longseespace
Last active September 25, 2025 07:43
Show Gist options
  • Save longseespace/b4a23c9ea3c053efa22461416b5410cd to your computer and use it in GitHub Desktop.
Save longseespace/b4a23c9ea3c053efa22461416b5410cd to your computer and use it in GitHub Desktop.
Get the current user's profile picture using CBIdentity
import Foundation
import Collaboration
func getMacUserProfileImage() -> NSImage? {
// Get the current user's profile picture using CBIdentity
let username = NSUserName()
// Create CBIdentity for the current user
if let identity = CBIdentity(name: username, authority: .default()) {
// Get the user's profile image
return identity.image
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment