The Dilema
Hey guys, I am working on a colour recognition app for iPhones that has the ability to look at a colour in real time and give feedback to the user as to what colour it is. I am a swift amateur so I would appreciate any positive criticism and feedback or suggestions.
So What is the Problem?
So I have been doing my research as I go and even posted to forums like Stack Overflow to find an answer. I've recieved some replies that could give me some direction which hinted at the use of the captureOutput method of my sampleBufferDelegate which seemed to work all well and good before I tried to locate data using the CMSampleBufferGetDataBuffer method:
sampleBuffer = CMSampleBufferGetDataBuffer(output!) as! CMSampleBuffer
And I started to get errors saying output was NULL or nil. I understood this because I created it being wraped and never actually initialized it.
So I commented it out and decided to go back to my viewDidLoad() method to initialize output before the program even ran. After looking into the constructor that my output needed to be (Which mind you specifies in the parameter declaration that it takes a void *makeDataReadyRefcon which xcode instead insists is actually an UnsafeMutableRawPointer?), I attempted to initialize my CMSampleBuffer to use with my sampleBuffer.
However, I have now ran into the issue of needing an UnsafeMutableRawPointer object, which unsurprisingly does not have a constructor or initialize method to my knowledge. So I tried my best to tinker around and perhaps use the init() method to initialize it, but it still keeps coming out as nil whenever I try to parse it as a parameter.
I have been stuck on this issue for a few months now and have considered forum posting as a last resort.