<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="">Did you make the class and its methods public?<div class=""><br class=""></div><div class="">Jack<br class=""><div><blockquote type="cite" class=""><div class="">On Dec 11, 2015, at 6:16 PM, Gage Morgan <<a href="mailto:gagemorgan@outlook.com" class="">gagemorgan@outlook.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Here's what I'm getting:<div class=""><br class=""></div><div class=""><div class="">/home/mgage/swift-cairo-bindings/test/main.swift:4:15: error: module 'Cairo' has no member named 'Surface'</div><div class="">let surface = Cairo.Surface(format: CAIRO_FORMAT_ARGB32, width: 421, height: 410)</div><div class=""> ^~~~~ ~~~~~~~</div><div class=""><unknown>:0: error: build had 1 command failures</div><div class=""><br class=""></div><div class="">So what I'm trying to do is to put all wrappings in a separate module named Cairo. Then, I want to use those methods outside of the module named Cairo. I renamed the class to Surface and fixed all references, but for some reason it keeps saying something about Surface not present. I need to look into whether a git repo may be needed.</div><br class=""><div class=""><hr id="stopSpelling" class="">Subject: Re: [swift-users] Need Help with C-to-Swift (finally)<br class="">From: <a href="mailto:harlan@harlanhaskins.com" class="">harlan@harlanhaskins.com</a><br class="">Date: Fri, 11 Dec 2015 20:31:20 -0500<br class="">CC: <a href="mailto:jackl@apple.com" class="">jackl@apple.com</a>; <a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">To: <a href="mailto:gagemorgan@outlook.com" class="">gagemorgan@outlook.com</a><br class=""><br class="">Nope, but you’ll need a way to specify the class inside the module (the fully-qualified type name)<div class=""><br class=""></div><div class=""><font face="Menlo" class="">Cairo.Cairo</font><span class="Apple-converted-space"> </span>should work fine.</div><div class=""><br class=""><div class=""><blockquote class=""><div class="">On Dec 11, 2015, at 8:14 PM, Gage Morgan <<a href="mailto:gagemorgan@outlook.com" class="">gagemorgan@outlook.com</a>> wrote:</div><br class="ecxApple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">The module is Cairo. Do I need to change something (I'm assuming by struct you mean the name of the class containing wrappings). The class is named Cairo as well. Could renaming the module to ModCairo fix this?<br class=""><br class=""><div class="ecxacompli_signature">Sent from<span class="ecxApple-converted-space"> </span><a href="https://aka.ms/qtex0l" target="_blank" class="">Outlook Mobile</a></div><br class=""></div><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div class="ecxgmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">On Fri, Dec 11, 2015 at 5:11 PM -0800, "Harlan Haskins"<span class="ecxApple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:harlan@harlanhaskins.com" target="_blank" class="">harlan@harlanhaskins.com</a>></span><span class="ecxApple-converted-space"> </span>wrote:<br class=""><br class=""></div><div dir="auto" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div class="">Is your struct named Cairo or Surface?</div><div id="ecxx_AppleMailSignature" class=""><br class=""></div><div id="ecxx_AppleMailSignature" class="">If Cairo is the module name, you're trying to instantiate the module.<br class=""><br class=""></div><div id="ecxx_AppleMailSignature" class="">- Harlan</div><div class=""><br class="">On Dec 11, 2015, at 7:55 PM, Gage Morgan <<a href="mailto:gagemorgan@outlook.com" class="">gagemorgan@outlook.com</a>> wrote:<br class=""><br class=""></div><blockquote class=""><div class=""><div dir="ltr" class=""><span style="font-size: 15px; line-height: 21.3px; background-color: rgb(255, 255, 255);" class="">How would you use things like cairo.moveTo() outside of the wrapping file? I've gone as far as writing a module named "Cairo," taking the methods as mentioned above out, and moving them to their own directory "tests." I have added "Cairo" as a dependency for "tests," but there appears to be something wrong when I try to call:</span><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);" class=""><br style="line-height: 21.3px;" class=""></div><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);" class="">let cairo = Cairo(format: CAIRO_FORMAT_ARGB32, width: 421, height: 410)</div><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);" class=""><br style="line-height: 21.3px;" class=""></div><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);" class="">Why can I not call Cairo()? The error:</div><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);" class=""><br style="line-height: 21.3px;" class=""></div><div style="line-height: 21.3px; font-size: 15px; background-color: rgb(255, 255, 255);" class=""><div style="line-height: 21.3px;" class="">Compiling Swift Module 'test' (1 sources)</div><div style="line-height: 21.3px;" class="">/home/mgage/swift-cairo-bindings/test/main.swift:4:18: error: cannot call value of non-function type 'module<Cairo>'</div><div style="line-height: 21.3px;" class="">let cairo = Cairo(format: CAIRO_FORMAT_ARGB32, width: 421, height: 410)</div><div style="line-height: 21.3px;" class=""> ~~~~~^</div><div style="line-height: 21.3px;" class=""><unknown>:0: error: build had 1 command failures</div><div style="line-height: 21.3px;" class="">swift-build: exit(1): ["/home/mgage/Downloads/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swift-build-tool", "-f", "/home/mgage/swift-cairo-bindings/test/.build/debug/test.o/llbuild.yaml"]</div><div style="line-height: 21.3px;" class=""><br class=""></div><div style="line-height: 21.3px;" class="">I don't know whether or not I want to translate methods into straight-up properties yet.</div><div style="line-height: 21.3px;" class=""><br style="line-height: 21.3px;" class=""></div><div style="line-height: 21.3px;" class="">Thanks, support here has been great so far. Cheers!</div><div style="line-height: 21.3px;" class="">--MGage--</div><div class=""><br class=""></div></div><br class=""><div class=""><hr id="ecxx_stopSpelling" class="">Subject: Re: [swift-users] Need Help with C-to-Swift (finally)<br class="">From:<span class="ecxApple-converted-space"> </span><a href="mailto:harlan@harlanhaskins.com" class="">harlan@harlanhaskins.com</a><br class="">Date: Fri, 11 Dec 2015 19:35:46 -0500<br class="">CC:<span class="ecxApple-converted-space"> </span><a href="mailto:gagemorgan@outlook.com" class="">gagemorgan@outlook.com</a>;<span class="ecxApple-converted-space"> </span><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">To:<span class="ecxApple-converted-space"> </span><a href="mailto:jackl@apple.com" class="">jackl@apple.com</a><br class=""><br class=""><div class="">I considered that but couldn't find a cairo_get_font_scale function quickly to complement the setter<span class="ecxApple-converted-space"> </span><img src="https://a.gfx.ms/emoji_1F605.png" class="ecxx_Emoji$1F605$AD4 ecxx_RenderedEmoji" title="Smiling face with open mouth and cold sweat" alt="Smiling face with open mouth and cold sweat"></div><div id="ecxx_ecxAppleMailSignature" class=""><br class=""></div><div id="ecxx_ecxAppleMailSignature" class="">But yes, a full wrapper would transparently handle getting and setting.<br class=""><br class=""></div><div id="ecxx_ecxAppleMailSignature" class="">- Harlan</div><div class=""><br class="">On Dec 11, 2015, at 7:28 PM, Jack Lawrence <<a href="mailto:jackl@apple.com" class="">jackl@apple.com</a>> wrote:<br class=""><br class=""></div><blockquote class=""><div class="">For getter-setter pairs like `setLineWidth`, you might consider turning them into properties:<div class=""><br class=""></div><div class=""><span style="font-family: Calibri; font-size: 16px;" class="">cairo.setLineWidth(0.1) // old</span></div><div class=""><span style="font-family: Calibri; font-size: 16px;" class="">cairo.lineWidth = 0.1 // new</span></div><div class=""><div class=""><br class=""><div class=""><blockquote class=""><div class="">On Dec 11, 2015, at 4:22 PM, Gage Morgan via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="ecxx_ecxApple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">Harlan,<div class=""><br class=""></div><div class="">The answer is yes. I even managed to get a couple you didn't list on my own:</div><div class=""><br class=""></div><div class=""><div class="">let cairo = Cairo(format: CAIRO_FORMAT_ARGB32, width: 421, height: 410)</div><div class="">cairo.scale(10.0, y: 10.0)</div><div class="">cairo.moveTo(29.0, y: 14.7)</div><div class="">cairo.lineTo(37.6, y: 13.0)</div><div class="">cairo.moveTo(37.6, y: 13.0)</div><div class="">cairo.lineTo(30.4, y: 22.2)</div><div class="">cairo.moveTo(30.4, y: 22.2)</div><div class="">cairo.lineTo(29.0, y: 14.7)</div><div class="">cairo.setLineWidth(0.1)</div><div class="">cairo.stroke()</div><div class="">cairo.surfaceWriteToPNG("boobs.png")</div><div class=""><br class=""></div><div class="">Swift is both really neat and really frustrating when learning it. </div><br class=""><div class=""><hr id="ecxx_ecxstopSpelling" class="">Subject: Re: [swift-users] Need Help with C-to-Swift (finally)<br class="">From:<span class="ecxx_ecxApple-converted-space"> </span><a href="mailto:harlan@harlanhaskins.com" class="">harlan@harlanhaskins.com</a><br class="">Date: Fri, 11 Dec 2015 17:21:38 -0500<br class="">CC:<span class="ecxx_ecxApple-converted-space"> </span><a href="mailto:kwame.bryan@gmail.com" class="">kwame.bryan@gmail.com</a>;<span class="ecxx_ecxApple-converted-space"> </span><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">To:<span class="ecxx_ecxApple-converted-space"> </span><a href="mailto:gagemorgan@outlook.com" class="">gagemorgan@outlook.com</a><br class=""><br class="">Gage,<div class=""><br class=""></div><div class="">Sorry, I just got back from class.</div><div class=""><br class=""></div><div class="">I’ll respond in line!</div><div class=""><br class=""><div class=""><blockquote class=""><div class="">On Dec 11, 2015, at 5:09 PM, Gage Morgan <<a href="mailto:gagemorgan@outlook.com" class="">gagemorgan@outlook.com</a>> wrote:</div><br class="ecxx_ecxApple-interchange-newline"><div class=""><div class=""><div class="">Harlan,</div><div class=""><br class=""></div><div class="">I read on<span class="ecxx_ecxApple-converted-space"> </span><a dir="ltr" href="http://cairographics.org/" target="_blank" class="">cairographics.org</a><span class="ecxx_ecxApple-converted-space"> </span>about bindings awhile back. I think they want cairo, not surface, so we would have something like:</div><div class=""><br class=""></div><div class="">let cairo = Surface(format: CAIRO_FORMAT_ARGB32, width: 240, height: 80)</div><div class="">cairo.setFontFace("serif", weight: CAIRO_FONT_WEIGHT_BOLD)</div><div class="">cairo.setFontSize(32.0)</div><div class="">cairo.setSourceRGB(0.0, g: 0.0, b: 1.0)</div><div class="">cairo.moveTo(x: 10, y: 50)</div><div class="">cairo.showText("Hello, World!")</div><div class="">cairo.writeToPNG("hello.png")</div><div class=""><br class=""></div><div class="">Would this work the same as before without "surface" but instead "cairo”?<br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">Absolutely! That’s just a variable name — it could be called ‘puppies’, though that’s not very readable.</div><br class=""><blockquote class=""><div class=""><div class=""><div class=""><br class=""><div class="ecxx_ecxacompli_signature">Sent from<span class="ecxx_ecxApple-converted-space"> </span><a href="https://aka.ms/qtex0l" target="_blank" class="">Outlook Mobile</a></div><br class=""></div><br class=""><br class=""><br class=""><div class="ecxx_ecxgmail_quote">On Fri, Dec 11, 2015 at 2:00 PM -0800, "Gage Morgan via swift-users"<span class="ecxx_ecxApple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>></span><span class="ecxx_ecxApple-converted-space"> </span>wrote:<br class=""><br class=""></div><div class=""><div class="">I went and looked at it, and even now it looks like I want to take every function I've used in Cairo and translate it to Swift. Swift is such a...simple language compared to everything else. That being said, as a result of the specs, it is also much more verbose in terms of writing the code. Compared to other languages, it is written out instead of shoved onto a few lines. </div><div class=""><br class=""></div><div class="">Is there a way to import modules into other modules? Because it looks like a weekend project that will eventually get posted by myself at<span class="ecxx_ecxApple-converted-space"> </span><a href="http://github.com/Christoffen-Corporation" target="_blank" class="">http://github.com/Christoffen-Corporation</a>. <br class=""><br class=""><div class="ecxx_ecxx_acompli_signature">Sent from<span class="ecxx_ecxApple-converted-space"> </span><a href="https://aka.ms/qtex0l" target="_blank" class="">Outlook Mobile</a></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">I’d recommend having a look at the Swift package manager example again — <a href="https://github.com/apple/swift-package-manager/blob/master/Documentation/SystemModules.md" target="_blank" class="">https://github.com/apple/swift-package-manager/blob/master/Documentation/SystemModules.md</a></div><div class=""><br class=""></div><div class="">There’s an example of using those modules together.</div><br class=""><blockquote class=""><div class=""><div class=""><div class=""><br class=""><div class="ecxx_ecxx_gmail_quote">On Fri, Dec 11, 2015 at 1:52 PM -0800, "Gage Morgan via swift-users"<span class="ecxx_ecxApple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>></span><span class="ecxx_ecxApple-converted-space"> </span>wrote:<br class=""><br class=""></div><div class=""><div class="">I meant the code posted in the Gist link above. I don't know jack squat about qsort. I'm hoping that if I can reverse-engineer code already produced, I can apply it to other parts of Cairo. <br class=""><br class=""><div class="ecxx_ecxx_x_acompli_signature">Sent from<span class="ecxx_ecxApple-converted-space"> </span><a href="https://aka.ms/qtex0l" target="_blank" class="">Outlook Mobile</a></div></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">I’ll go ahead and comment it, but I think it’s simplistic enough that it should be readable with a grasp of some Swift concepts. Perhaps it’s a good idea to look through The Swift Programming Language to figure out some of the constructs I used — they’re fairly basic constructs.</div><br class=""><blockquote class=""><div class=""><div class=""><div class=""><div class=""><br class=""><div class="ecxx_ecxx_x_gmail_quote">On Fri, Dec 11, 2015 at 1:34 PM -0800, "Kwame Bryan"<span dir="ltr" class=""><<a href="mailto:kwame.bryan@gmail.com" target="_blank" class="">kwame.bryan@gmail.com</a>></span><span class="ecxx_ecxApple-converted-space"> </span>wrote:<br class=""><br class=""></div><div style="word-wrap: break-word;" class="">Tutorial on the subject. <a href="http://chris.eidhof.nl/posts/swift-c-interop.html" target="_blank" class="">http://chris.eidhof.nl/posts/swift-c-interop.html</a> <div class=""><br class=""></div><div class="">Regards</div><div class="">Kwame</div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=-2FcgwiRAxmHDdptrhrsAJKMBtNqQpWV-2BwUfjpvH9AIapmo3-2BHsnvTus94jzsAd9QbgrzJUOBMUGL1vbZcJzhtyVp8DdIXzqymeEFv78CU98Vyvkel-2BZ9jAScwY1YDPFzrfK4k0wzAL0RYvODDsxuakhZXZY7WUvtIDD6jT8hO1G12IjFAP4zcPGisA85WWuoE0N2vgQ90Wpd69-2B1PAy-2FgJ6kuPbhfqVCSq9RdDYqcqzU-3D" alt="" width="1" height="1" border="0" style="height: 1px !important; width: 1px !important; border-width: 0px !important; padding: 0px !important;" class=""></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=-2FcgwiRAxmHDdptrhrsAJKMBtNqQpWV-2BwUfjpvH9AIapEPR-2FCXY9amYXSxN3Pbi2XrZMfHEN794BjyOKzqKEN1I5HM69Lqapv6DjsA6FzE8d9q3N3v71RBohhpxfFJmwu-2FppXm9-2F5fp7k5-2B6DDHtFIR52wVygcHpVKdRV8liNPtLvkthJRTxyuxSppBSc-2BI5r-2B9L8DyZNdiOAXPmJzd91Fd8lk3drIZ4JVKfkyoAcyrw-3D" alt="" width="1" height="1" border="0" style="height: 1px !important; width: 1px !important; border-width: 0px !important; padding: 0px !important;" class=""></div></div><span id="ecxx_ecxcid:CAD42AA7-159A-44FE-8B20-00668767F2BB@student.rit.edu." class=""><Mail Attachment.txt></span><span id="ecxx_ecxcid:0E99C342-6109-49EF-9D11-9ADA11D25B61@student.rit.edu." class=""><Mail Attachment.txt></span></div></blockquote></div><br class=""></div></div></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=fPHCHxM8OEqkFI0LoY8YMuXDKRTx6ILsXcJMmyHEOCK1g2WPDrZyFsR7DLDlbrRiEA6-2FGdzFprAFvdEcY7UBE0x-2BFtj95YctjkpAVfe-2Bq7SV4xEdQv70imgp6XrHB8UEaqlZ4BYO9LAYgBuaTOwze-2B3ZnRJhC4BIQTgABw48xeW5yEF4z8bM-2F5EoYoKcqCRXbycyP-2Frx8zSSDmVf9vC2vt-2BHI1Qh6R8GHcjxzdgIsXQ-3D" alt="" width="1" height="1" border="0" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; padding: 0px !important;" class=""><span style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; display: inline !important;" class=""><span class="ecxx_ecxApple-converted-space"> </span></span><span style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><span style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; display: inline !important;" class="">swift-users mailing list</span><br style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><a href="mailto:swift-users@swift.org" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">swift-users@swift.org</a><br style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" target="_blank" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-users</a></div></blockquote></div></div></div></div></blockquote></div></div></div></blockquote></div></div></blockquote></div></div></div></div></div></div></blockquote></div><br class=""></div></body></html>