CocoaMQTT icon indicating copy to clipboard operation
CocoaMQTT copied to clipboard

XCFramework support

Open hhrvoic opened this issue 2 years ago • 5 comments

When exporting this library as a .xcframework users will get errors inside inside .swiftinterface file when including it in the project:

image

The name of the type/class (CocoaMQTT) and the module (CocoaMQTT) are the same so they clash in the .swiftinterface file. Compiler thinks that all the types are under CocoaMQTT class, not under the CocoaMQTT module => limitation where if a module and a type have the same name, as usage is assumed to be the type first. One of the simpler ways of avoiding this is to rename the CocoaMQTT class to something else. This would however be the breaking change.

Similar issue: https://github.com/parse-community/Parse-SDK-iOS-OSX/issues/1601

hhrvoic avatar Jun 20 '22 06:06 hhrvoic

Hi, I guess you want to call swift method in OC language?

leeway1208 avatar Jun 20 '22 14:06 leeway1208

Hi, no, using CocoaMQTT in Swift project, the issue is when you want to export this library as a .xcframework and embed it as such in the project. These ⬆️ are the errors that pop up since the class name (CocoaMQTT) is the same as the library name (CocoaMQTT).

hhrvoic avatar Jun 30 '22 07:06 hhrvoic

I think the quickest way is change the class name from (CocoaMQTT) to (project)CocoaMQTT or something else.

leeway1208 avatar Jul 02 '22 15:07 leeway1208

Yeah, not sure about naming conventions on this project so I guess it's anything that works :) I see there is a CocoaMQTT5 class for the v5 of the protocol, maybe the original one which is used for the 3.1.1. could be renamed the CocoaMQTT3?

hhrvoic avatar Jul 15 '22 09:07 hhrvoic

This is also now represented as a warning in Xcode. https://github.com/apple/swift/issues/56573

Screenshot 2023-07-06 at 15 50 53

Any plans with this?

hhrvoic avatar Jul 06 '23 13:07 hhrvoic