قالب وردپرس درنا توس
Home / IOS Development / ios – Is it okay to set up my AVFoundation camera in a singleton?

ios – Is it okay to set up my AVFoundation camera in a singleton?



I've created a custom camera using AVFoundation. After extensive testing and research I came up with a solution to get my camera extremely fast to load when I went to camViewController. The solution is to have the setup of my camera inside a func in a singleton. The feature is called on viewDidLoad () by my basic view controls. When the user presses the button, I make a segue to camViewController where I create my preview layer. I never stop the recording session after I return to the base display controller.

I've been so worried about using this solution because of the dangers I sometimes hear / read about on-the-line. Thus: What are the disadvantages of doing this (memory / performance issues? Etc.) or should I completely steer clear of implementing this solution? Thanks!


Source link