I tried copying in your code into my ContentView and it hits me with 3 errors related to your else {} statement inside LoadImage. It offered 3 fixes which I implemented resulting in the following code:
func loadImage() {
guard let inputImage = inputImage else { return }
let beginImage : CIImage
if let ciImage = inputImage.ciImage {
beginImage = ciImage
}
else {
beginImage = CIImage(cgImage: inputImage.cgImage!).oriented(CGImagePropertyOrientation(rawValue: UInt32(inputImage.imageOrientation.rawValue))!)
}
However, this didn't seem to make any difference with Crystallize causing a crash. For what it's worth, I also downloaded Paul's project files from git and his code also crashes with the same file error.
Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
That is reported on this line in applyProcessing()
guard let outputImage = currentFilter.outputImage else { return }
And the terminal reports this when pressing the Select Filter button that triggers the ActionSheet:
2020-05-26 15:56:10.071754-0700 Instafilter[6090:271140] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x600002f4b890 UIView:0x7fb791729150.width == - 16 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600002f4b890 UIView:0x7fb791729150.width == - 16 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
This error reporting is a bit beyond my knowledge, especially since I am not familiar with UIKit.