[swift-users] .apinotesc file placement?

Roderick Mann rmann at latencyzero.com
Wed Nov 29 19:31:26 CST 2017



> On Nov 29, 2017, at 16:23 , Jonathan Prescott <jprescott12 at icloud.com> wrote:
> 
> As a general question since I’m just getting into Swift frameworks, could the framework architecture not be right?  When I build a non-Swift(C/C++/Obj-C/Obj-C++/other language/etc) based framework using Xcode to build the framework, the Info.plist goes into a Resources folder/directory and the module map goes into a Modules folder/directory.  I seem to recall reading somewhere that the .apinotes file for swift should go into the same directory as the module map.
> 
> If the listing in the e-mail represents the framework file architecture, and there doesn’t seem to be a Modules directory nor a Resources directory, could this be why swift is failing on the “import” directive?  How important is the directory architecture for Xcode frameworks to “work"?

Indeed, you're right. I added the Modules/ directory and followed up in a subsequent email. It finds and imports the module now, and it seems to know something about my renaming of the enum cases in the apinotes file, but still gets conflicting error messages (in one case, it tells me I have to use the new enum case name, and in another case it tells me that enum case name is not a member of the enum).

> 
> Just asking.
> 
> Jonathan
> 
>> On Nov 29, 2017, at 7:05 PM, Rick Mann via swift-users <swift-users at swift.org> wrote:
>> 
>> FWIW, I submitted an Xcode feature request via Radar:
>> 
>> 	https://bugreport.apple.com/web/?problemID=35757360
>> 
>> I also have this Framework:
>> 
>> $ ls -Rl lgscolibri.framework 
>> total 18128
>> drwxr-xr-x  3 rmann  staff    96B Nov 21 16:41 Headers/
>> -rwxr-xr-x  1 rmann  staff   888B Nov 21 16:41 Info.plist*
>> -rwxr-xr-x  1 rmann  staff   8.9M Nov 21 16:41 lgscolibri*
>> -rw-r--r--@ 1 rmann  staff   1.7K Nov 29 14:07 lgscolibri.apinotes
>> -rw-r--r--@ 1 rmann  staff    69B Nov 29 15:21 module.modulemap
>> 
>> With the attached .apinotes and module map, and it doesn't seem to be picked up by Xcode:
>> 
>> 	BLK360API.swift:10:8: error: no such module 'lgscolibri'
>> 	import lgscolibri
>> 	       ^
>> 
>> 
>> <lgscolibri.apinotes><module.modulemap>
>> 
>> Note that this is Swift 3.2; does that matter? Is 4.0 better?
>> 
>> 
>>> On Nov 2, 2017, at 13:22 , Rick Mann <rmann at latencyzero.com> wrote:
>>> 
>>> 
>>>> On Nov 1, 2017, at 14:27 , Jordan Rose <jordan_rose at apple.com> wrote:
>>>> 
>>>> Yep, you can! In fact, you don't even need to compile it. You can just put the apinotes file itself into the Headers/ directory and it will work, as long as
>>>> 
>>>> - the file has the same name as the framework, i.e. "MyKit.apinotes"
>>>> - the framework has a proper module map
>>>> 
>>>> (I have a task on me to write up documentation on this but haven't gotten around to it. It's not something most people need to do, but adapting an existing library is one of the more likely cases.)
>>> 
>>> I'd sure appreciate this. We get this binary iOS Framework from a vendor and need to integrate it. They know nothing of Swift, and their header is cross-platform, so they don't have any of the proper naming conventions or macros included. I don't really know how to write a robust and complete module map or apinotes file.
>>> 
>>> I'd love to be able to include both of those *outside* of the framework, so that I don't have to modify their provided items in any way. But for now, I can drop both files into the Framework they provide.
>>> 
>>> Thanks!
>>> 
>>>> 
>>>> Jordan
>>>> 
>>>> 
>>>>> On Oct 30, 2017, at 18:31, Rick Mann via swift-users <swift-users at swift.org> wrote:
>>>>> 
>>>>> I'm using a third-party C library shoehorned into a Framework. It does not have proper ENUM macros nor an apinotes file. I'd like to add one. I'm using Xcode 9. 
>>>>> 
>>>>> • Can I put the .apinotesc file in the Framework somewhere?
>>>>> • Can I make Xcode automatically compile it?
>>>>> 
>>>>> Thanks.
>>>>> 
>>>>> -- 
>>>>> Rick Mann
>>>>> rmann at latencyzero.com
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> swift-users mailing list
>>>>> swift-users at swift.org
>>>>> https://lists.swift.org/mailman/listinfo/swift-users
>>>> 
>>> 
>>> 
>>> -- 
>>> Rick Mann
>>> rmann at latencyzero.com
>>> 
>>> 
>> 
>> 
>> -- 
>> Rick Mann
>> rmann at latencyzero.com
>> 
>> 
>> 
>> 
>> 
>> -- 
>> Rick Mann
>> rmann at latencyzero.com
>> 
>> 
>> _______________________________________________
>> swift-users mailing list
>> swift-users at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
> 


-- 
Rick Mann
rmann at latencyzero.com




More information about the swift-users mailing list