[swift-users] CGContext endPage method ambiguous (two candidates) Swift 3/Xcode 8

davelist at mac.com davelist at mac.com
Fri Jun 17 19:09:42 CDT 2016


> On Jun 17, 2016, at 12:28 PM, Joe Groff <jgroff at apple.com> wrote:
> 
> 
>> On Jun 16, 2016, at 1:49 PM, Dave Reed via swift-users <swift-users at swift.org> wrote:
>> 
>> I've got a project I had been working on using Swift2.2 and decided to migrate to Swift3 (using Xcode 8 beta) before the project gets any bigger. I successfully migrated everything except I have a CGContext for writing to a PDF and calls the endPage() method. For that the compiler responds with "ambiguous use of endPage()" and claims to find two candidates for it.
>> 
>> Is there a work around for this?
> 
> This came up in the WWDC labs this week too. One possible workaround is to wrap the original CGPDFContextEndPage function in your bridging header, then call the wrapper function from Swift.
> 
> -Joe
> 

I’ve never mixed Objective-C/C and Swift in the same project but I think I find some documentation online for doing this. Unfortunately, my call to endPage is in a framework and it appears frameworks cannot use bridging headers (got the error "using bridging headers with framework targets is unsupported”).

I guess I’ll have to wait for this to be fixed before I can use that part of the app again. Not a major crisis since I’m still a few months away from it being done (which is why I made the change to Swift 3 now). Hopefully it will get fixed reasonably soon since I suspect it’s some sort of minor typo.

Thanks,
Dave



More information about the swift-users mailing list