<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">We don't have explicit support for api notes in SwiftPM.<div class=""><br class=""></div><div class="">We discussed it, and it something which probably makes sense, but no one has worked on a design or implementation yet.</div><div class=""><br class=""></div><div class=""> - Daniel</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On May 12, 2017, at 11:32 AM, Michael Gottesman via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">+Ankit<div class=""><br class=""></div><div class="">Michael</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 12, 2017, at 10:10 AM, Geordie J via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">To continue this thread: I managed to annotate a bunch of C APIs with modulename.apinotes. This works with Xcode (to a certain degree - pointers, enums, and especially OpaquePointers are tricky). I’m now trying to build my package with SwiftPM and it doesn’t seem to recognise the apinotes file. </div><div class=""><br class=""></div><div class="">@Doug Gregor, would you be able to advise as to whether apinotes works with SwiftPM (on Linux) and whether it requires some extra settings that I may be unaware of?</div><div class=""><br class=""></div><div class="">Thanks and best regards for the weekend,</div><div class="">Geordie</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">Am 08.05.2017 um 00:51 schrieb Geordie Jay <<a href="mailto:geojay@gmail.com" class="">geojay@gmail.com</a>>:</div><br class="Apple-interchange-newline"><div class="">I'm having the same issue. The renames seem to work, as in they disappear from the global scope with a fixit to rename to the new (namespaced) version if I type in the name manually, but they don't appear as static members of the enum type, regardless of how I call them. Would appreciate some help with this too.<br class=""><br class="">Cheers,<br class="">Geordie <br class=""><div class="gmail_quote"><div dir="ltr" class="">Rick Mann <<a href="mailto:rmann@latencyzero.com" class="">rmann@latencyzero.com</a>> schrieb am So. 7. Mai 2017 um 23:06:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm trying to use apinotes for this third-party C library (call it "Lib.dylib"). It has an enum lgs_error_t:<br class="">
<br class="">
typedef enum {<br class="">
lgs_error_none = 0,<br class="">
lgs_error_invalid_handle = -1,<br class="">
lgs_error_null = -2,<br class="">
lgs_error_invalid_parameter = -3,<br class="">
lgs_error_invalid_operation = -4,<br class="">
lgs_error_queue_full = -5<br class="">
} lgs_error_t;<br class="">
<br class="">
So I wrote apinotes ("Lib.apinotes") that look like this, next to the .dylib, and part of my Xcode iOS app target:<br class="">
<br class="">
Enumerators:<br class="">
# lgs_error_t<br class="">
<br class="">
- Name: lgs_error_none<br class="">
SwiftName: lgs_error_t.none<br class="">
- Name: lgs_error_invalid_handle<br class="">
SwiftName: lgs_error_t.invalidHandle<br class="">
- Name: lgs_error_null<br class="">
SwiftName: lgs_error_t.nullParameter<br class="">
- Name: lgs_error_invalid_parameter<br class="">
SwiftName: lgs_error_t.invalideParameter<br class="">
- Name: lgs_error_invalid_operation<br class="">
SwiftName: lgs_error_t.invalidOperation<br class="">
- Name: lgs_error_queue_full<br class="">
SwiftName: lgs_error_t.queueFull<br class="">
<br class="">
But this line of code fails:<br class="">
<br class="">
var err: lgs_error_t = .nullParameter<br class="">
Type 'lgs_error_t' has no member 'nullParameter'<br class="">
<br class="">
Am I missing something else?<br class="">
<br class="">
> On May 4, 2017, at 16:55 , Douglas Gregor via swift-users <<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>> wrote:<br class="">
><br class="">
><br class="">
>> On May 3, 2017, at 4:10 PM, Geordie J via swift-users <<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>> wrote:<br class="">
>><br class="">
>> Hi everyone,<br class="">
>><br class="">
>> I’m about to start on another big project with Swift on Android and would like to annotate that JNI headers as much as possible before I do: specifically I’d like to make _Nonnull and CF_SWIFT_NAME annotations to the headers found in a user's jni.h.<br class="">
>><br class="">
>> The question is: is it possible to annotate headers this without changing the original header files? Specifically I’m looking for an options that allows annotations in a separate file, probably one that is read when loading the package’s module.modulemap.<br class="">
>><br class="">
>> I’d like to distribute the annotations in a SwiftPM package that also exposes the original (hopefully annotated) headers. Up until now I’ve been using Swift to override methods in code, but this isn’t as clean or extensible and I fear it may have other (particularly performance) implications.<br class="">
>><br class="">
>> I guess the alternative would be to just maintain and distribute a modified version of jni.h with the annotations, but that would be a "last resort” option.<br class="">
><br class="">
><br class="">
> This is the role of API notes, which you can see here:<br class="">
><br class="">
> <a href="https://github.com/apple/swift/tree/master/apinotes" rel="noreferrer" target="_blank" class="">https://github.com/apple/swift/tree/master/apinotes</a><br class="">
><br class="">
> with some rough documentation-in-source here:<br class="">
><br class="">
> <a href="https://github.com/apple/swift-clang/blob/stable/lib/APINotes/APINotesYAMLCompiler.cpp" rel="noreferrer" target="_blank" class="">https://github.com/apple/swift-clang/blob/stable/lib/APINotes/APINotesYAMLCompiler.cpp</a><br class="">
><br class="">
> - Doug<br class="">
><br class="">
> _______________________________________________<br class="">
> swift-users mailing list<br class="">
> <a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a><br class="">
> <a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class="">
<br class="">
<br class="">
--<br class="">
Rick Mann<br class="">
<a href="mailto:rmann@latencyzero.com" target="_blank" class="">rmann@latencyzero.com</a><br class="">
<br class="">
<br class="">
</blockquote></div></div></blockquote></div><br class=""></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></div></body></html>