Cocoanetics / DTFoundation

Standard toolset classes and categories
BSD 2-Clause "Simplified" License
803 stars 237 forks source link

SPM: Some Categories not visible #127

Closed odrobnik closed 4 years ago

odrobnik commented 4 years ago

I am looking for an explanation and/or fix why category extensions in UIView+DTFoundation.h/m cannot be used when importing this Package via SPM

colejd commented 4 years ago

For what it's worth, the issue I ran into was only at runtime. It was not detected at build time.

odrobnik commented 4 years ago

@colejd please explain.

odrobnik commented 4 years ago

The file is definitely part of the Package:

image

It even gets compiled:

image

But seemingly all the UIKit-based extensions are missing:

image

Although, some are there, like NSURL+DTAppLinks which is also in the same Core/Source/iOS subfolder:

let bla = NSURL.appStoreReview(forApplicationIdentifier: "123")

This works.

odrobnik commented 4 years ago

I found that adding #import <TargetConditionals.h> to the header and moving the import for the header in the .m to above the #if TARGET_OS_IPHONE resolved the problem.

It might be that adding these defines manually to the Package file doesn't always work, and the import in the PCH file seems to be ignored for Packages.

colejd commented 4 years ago

Thanks. That seems to have done the trick on my end.

The runtime issues I mentioned earlier seem to be internal to DTCoreText, so I've made a new issue above.