spierce7
06/29/2018, 4:59 AMinitBy(ViewController(aDecoder)), but initBy is deprecated. The message tells me I can replace initBy with @OverrideInit on the constructor, but every time I do, I get an error: constructor with @OverrideInit doesn't override any super class constructor. Is there an example somewhere of how to use this annotation properly? It seems no matter what I do it doesn't work.svyatoslav.scherbina
06/29/2018, 5:10 AMconstructor(aDecoder: NSCoder), and aDecoder parameter name doesn’t match super constructor.spierce7
06/29/2018, 5:16 AM@ExportObjCClass
class ViewController @OverrideInit constructor(aDecoder: NSCoder) : UIViewController(aDecoder) {
@ObjCOutlet lateinit var label: UILabelspierce7
06/29/2018, 5:19 AMError:(7, 1) constructor with @OverrideInit doesn't override any super class constructor.svyatoslav.scherbina
06/29/2018, 5:23 AMconstructor(coder: NSCoder)
So your constructor parameter should be coder: NSCoder too:
class ViewController @OverrideInit constructor(coder: NSCoder) : UIViewController(coder) {spierce7
06/29/2018, 5:53 AM