Reusable code

Hello,
I have some snippets of code I’d like to use in different projects without haveing to write them all over every time (i.e. centering a window on the screen, methods of converting angle to and from sexagesimal into radian, and so on.
I saved those snippets exporting them from an early application but, when I import them into a new project, they always create a new App, usually named App1, which I have to delete.
I wonder if there is a spevific way to save those fragments of reusable code so to be able to import them whenever I need without the hassle of the new App.

Thank you

right clic on the method, choose “make external”

then from the finder (or explorer on windows) just drag-drop the external file to a new project

https://documentation.xojo.com/topics/code_management/sharing_code_among_multiple_projects.html

make sure you use a link or it would copy/import the source code into your project.
with a link it is really shared but you can also break other projects if you modify this one source code.

As well, if you start using “External” items in your projects (which is very helpful), be aware that if you wish to continue sharing these bits of code live with other projects: avoid using the File > Collect Project Items... menu command.

Using “Collect Project Items” will copy all your External Item files to a local “Code” folder in your project root folder. These new local copies of your External files are no longer linked with your other projects. Your other projects will still continue to work, but the code contained in the local External Items are no longer shared.

Sometimes you may want that, but probably most of the time you won’t.

I hope that helps.

Thanks everybody