100% right. That solution is by far better if you wanted to work with the CGPathElement, since that's block-representable. My solution was assuming (perhaps wrongly) to want to represent it as a Swift type. You're the best, as always! :)
Cheers! Zach On Fri, May 13, 2016, at 12:57 AM, Quinn The Eskimo! via swift-users wrote: > > On 13 May 2016, at 06:24, Zach Waldowski via swift-users > <swift-users@swift.org> wrote: > > > Problems are just like any context-based C API, you need to squeeze all > > … and the best way to do that is to use a closure. > > typealias CGPathApplierBlock = @convention(block) (CGPathElement) -> Void > > func CGPathApplyBlock(path: CGPath, @noescape block: CGPathApplierBlock) > { > CGPathApply(path, unsafeBitCast(block, > UnsafeMutablePointer<Void>.self), { info, element in > let block2 = unsafeBitCast(info, CGPathApplierBlock.self) > block2(element.memory) > }) > } > > Share and Enjoy > -- > Quinn "The Eskimo!" <http://www.apple.com/developer/> > Apple Developer Relations, Developer Technical Support, Core OS/Hardware > > > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users _______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users