CGContext endPage method ambiguous (two candidates) Swift 3/Xcode 8

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?

I submitted it via bugreport.apple.com (# 26815976) but is there a better place to report this?

Also, while the app won't be ready to release until after iOS 10 is released, I would like to start TestFlight beta testing it before that. After doing the conversion, I remembered that you can't submit builds with beta versions of Xcode to the AppStore. Does this also apply to TestFlight betas? I hope not given that Apple is strongly encouraging everyone to convert their code to Swift 3, but I suspect that is the policy.

Thanks,
Dave Reed

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

···

On Jun 16, 2016, at 1:49 PM, Dave Reed via swift-users <swift-users@swift.org> wrote:

I submitted it via bugreport.apple.com (# 26815976) but is there a better place to report this?

Also, while the app won't be ready to release until after iOS 10 is released, I would like to start TestFlight beta testing it before that. After doing the conversion, I remembered that you can't submit builds with beta versions of Xcode to the AppStore. Does this also apply to TestFlight betas? I hope not given that Apple is strongly encouraging everyone to convert their code to Swift 3, but I suspect that is the policy.

Thanks,
Dave Reed

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

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

···

On Jun 17, 2016, at 12:28 PM, Joe Groff <jgroff@apple.com> wrote:

On Jun 16, 2016, at 1:49 PM, Dave Reed via swift-users <swift-users@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