How to programmatically create shortcut of my macOSX application and add it in docbar using swift

I want to create shortcut of my application on desktop programatically and also add it to the docbar. At present i am doing it using bristow and emmet executables using shell script. I want to know is there any API in any of the frameworks that helps me to do using swift

Replies

Did you read this and follow the links ?


https://stackoverflow.com/questions/13953475/mac-osx-how-to-add-app-icon-to-dock-programmatically

If you find a way to do so, you should ask user if he/she accepts it. Otherwise, that would be a bit too obtrusive.

There’s no good way to programmatically manipulate items in the Dock. This isn’t an accident. Apple consider the Dock setup to be something that the user controls, and apps shouldn’t be messing with it.

You’ll find lots of folks who ignore this advice and use various unsupported techniques to modify the Dock setup. You are, of course, free to do the same, but I’d caution you against that. To start, it’s unsupported and might break in weird ways in the future. Beyond that, it’ll make users grumpy. If the user has gone to the trouble of installing your app, they won’t have a problem finding it in the Applications directory, and they are also quite capable of adding your app to their Dock. Doing it for them isn’t a big win for most users, and it’s a big lose for some fraction of users, like myself, who will hate you forever if you monkey with our Dock (-:

Similar logic applies to the Desktop folder, and to the various recent items lists.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
  • Hi Quinn,

    Is this (not programmatically manipulate items) true for the Favourites list too?

    Massimo

Add a Comment