krzysztofzablocki / Inject

Hot Reloading for Swift applications!
MIT License
2.14k stars 114 forks source link

Why `Hosts` are not available in non-DEBUG configs? #12

Closed ms-int closed 2 years ago

ms-int commented 2 years ago

Error occurs while compiling for config inheriting from Debug config. On Debug config works well. Zrzut ekranu 2022-04-6 o 11 40 01 .

krzysztofzablocki commented 2 years ago

I strip those symbols if you don't define DEBUG so that they don't land in production application. This is by design since unlike SwiftUI integration hosts can't be true NO-OP and would incur some cost to your application (additional view layer etc).

So if your config is still a DEBUG'ing one you shouldn't overwrite DEBUG flag, but if it isn't then I'd say don't leave this code in for prod, I usually just commit the Injection host as a separate commit I can easily remove before finishing the feature

ghost commented 2 years ago

I believe XCode new projects have two default configurations, Debug and Release, and SPM works only with that two configurations. even if your custom configuration is DEBUG, I believe if we change that configuration name when we import any SPM module XCode will show an error like this.

wojciech-kulik commented 2 years ago

Maybe we could add support for release code this way: #14