Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Constructing an object of class type 'ClassName' with a metatype value must use a 'required' initializer XCode8 Swift 3 changes

Tags:

xcode

ios

swift3

I'm struggling with this particular error as a result of XCode 8 swift 3 changes, and can't find anywhere a detailed explanation as to why this is happening.

Error:

Constructing an object of class type 'PermissionScope' with a metatype value must use a 'required' initializer

In Method:

public convenience init() {
    type(of: self).init(backgroundTapCancels: true)
}

Any help would be appreciated.

like image 386
TomV Avatar asked Oct 07 '16 14:10

TomV


1 Answers

i think it means you should add the world 'required'

class PermissionScope {

   required init(backgroundTapCancels : Bool){

   }
}
like image 145
yy_xuelangwang Avatar answered Oct 28 '22 08:10

yy_xuelangwang