I replaced my second SKScene with CoreGraphics but it still does not address the issue. There is definitely memory leak every time I go to another ViewController. Searching on Internet did not reveal any workable solution.
The following:
@IBAction func goToWindVC(sender: UIBarButtonItem)
{
self.spriteViewDep?.removeFromSuperview()
self.spriteViewDep = nil
performSegueWithIdentifier("segueWind", sender: self)
}
gives the following error:
/BuildRoot/Library/Caches/com.apple.xbs/Sources/Metal/Metal-55.1.1/Framework/MTLTexture.m:643: failed assertion `MTLTextureDescriptor has one or more dimensions set that are zero or greater than the maximum allowed size.'
perhaps due to the Auto Layout, avoiding which is not an option.
Has anyone managed to implement it?
EDIT:
Looks like I just had to implement the following in the viewWillAppear to solve it:
if self.spriteViewDep == nil
{
... // Create scene
}
Do not see memory leak anymore.
Thanks a lot!