Hot to achieve the Photo Browser(a popup menu) in Mail.app or Notes.app

Hi, I want to achieve the Photo Browser(a popup menu) in Mail.app or Notes.app. What I want is like below:

I can add Continuity Camera menu items refereing to Document and sample code by LASER-Yi, what i get is like:

Well, apparently I can and only can add Continuity Camera menus, without Photos... menu item, even worse, my shortcuts show on the bottom of the menu.

So Is there any reccomendations of how to achieve a popup menu like Photo Browser?

Alright, after a period of exploration, the only method I can find to achieve Photos... menu item(which can open Photo Library in user's Apple ID) is using SidecarMenuController , a private interface in private framework: SidecarUI.framework

NSMenuItem *photosItem = [[NSMenuItem alloc] init];
[photosItem setTitle:@"Photos..."];
[photosItem setTarget:[SidecarMenuController sharedController]];
[photosItem setAction:@selector(showPhotosBrowser:)];
[menu addItem:photosItem];

I don't think it's suggested to use private framework, however the documentation about sidecar is so poor...

Hot to achieve the Photo Browser(a popup menu) in Mail.app or Notes.app
 
 
Q