Been using the code no problems for days. Sent out a beta and it crashes for everyone. I don't know why, but it seems that when it gets to this point it crashes:
block?(element.pointee)
I could only get it to crash doing a release build and I'm not proficient enough at swift to understand why it's failing.
Been using the code no problems for days. Sent out a beta and it crashes for everyone. I don't know why, but it seems that when it gets to this point it crashes:
block?(element.pointee)
I could only get it to crash doing a release build and I'm not proficient enough at swift to understand why it's failing.
Searching around for ideas/code I ran across this devforum post (notably Eskimo's): https://forums.developer.apple.com/message/15725#15725
I used this code he posted:
typealias CGPathApplierBlock = @convention(block) (CGPathElement) -> Void
extension CGPath { func apply(body: CGPathApplierBlock) { self.apply(info: unsafeBitCast(body, to: UnsafeMutableRawPointer.self)) { (info, element) in let block2 = unsafeBitCast(info, to: CGPathApplierBlock.self) block2(element.pointee) } } }
And now instead of: enumeratePathElements { element in
I use: cgPath.apply { element in
And it works without crashing in debug and release build. I'm building with xcode 9.1 and most testing on iOS 11 devices.