Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore using SPM modules to allow specific imports of components. #205

Open
mhdostal opened this issue Dec 5, 2022 · 4 comments
Open

Comments

@mhdostal
Copy link
Member

mhdostal commented Dec 5, 2022

No description provided.

@dfeinzimer
Copy link
Collaborator

dfeinzimer commented Dec 5, 2022

Not sure this carries over to Swift packages but I found the following in this article:

As far as performance and binary size goes, any unused symbols are already optimized out of the final binary by the Swift compiler. If there’s no reference to it at compile time then it’s removed, meaning that importing a framework but not using particular parts of it shouldn’t have any negative implications.

@mhdostal
Copy link
Member Author

mhdostal commented Dec 5, 2022

@dfeinzimer Thanks for that. Swift-Numerics has modules that you can import. You still have to include the whole Package in your project, but in individual files you can just import the bits you need. This is accomplished by having separate "Targets" in the "Package.swift" file. I'm not sure if this helps any (maybe with app size?); there doesn't seem to be a whole lot of documentation on it.

@rolson
Copy link
Contributor

rolson commented Dec 5, 2022

Since the toolkit will be added as a source dependency to an app, the compiler should strip out anything that is not needed. So if you were only using the authenticator, then you wouldn't bloat the binary with other components you aren't using.

@philium
Copy link
Contributor

philium commented Dec 5, 2022

I don't know if included frameworks would be stripped. It would be good to verify that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants