swift - Metal iOS gives compile error -
import uikit import metal import quartzcore class viewcontroller: uiviewcontroller { var device: mtldevice! = nil var metallayer: cametallayer! = nil override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. device = mtlcreatesystemdefaultdevice() metallayer = cametallayer() // 1 metallayer.device = device // 2 metallayer.pixelformat = .bgra8unorm // 3 metallayer.framebufferonly = true // 4 metallayer.frame = view.layer.frame // 5 view.layer.addsublayer(metallayer) // 6 } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } }
when have in viewcontroller.swift, error "use of undeclared type cametallayer
" though i've imported metal , quartzcore. how can code work?
metal code doesn't compile on simulator. try compiling device.
Comments
Post a Comment