Thursday, May 2, 2024
HomeiOS Developmentios - make the swift compiler to take away unused code?

ios – make the swift compiler to take away unused code?


I arrange a take a look at venture in Xcode and created two SPM targets. The primary goal will depend on the second and makes use of a category from it, however there’s additionally an unused public operate on this class. I compiled the venture and profiled the binary file’s dimension utilizing bloaty 1. It reveals me that my file (with the category containing the unused public operate) SomeClass.swift contributes 708 bytes to the general dimension, however after commenting out the unused operate, it contributes solely 624 bytes.

If I make this unused operate inner, SomeClass.swift additionally contributes 624 bytes.

I concluded that the compiler can omit inner capabilities due to whole-module optimization and useless code stripping, however it can’t acknowledge unused public code.

Am I proper, and the way can I get it to take away public capabilities?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments