Last active
September 25, 2025 07:43
-
-
Save longseespace/b4a23c9ea3c053efa22461416b5410cd to your computer and use it in GitHub Desktop.
Get the current user's profile picture using CBIdentity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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