Xcode is giving me this error for my Swift code:
'myColor' cannot be constructed because it has no accessible initializers
import Foundation
protocol Prototype {
func Clone<T>() -> T
}
class myColor: Prototype {
var red: Int?
var green: Int?
var blue: Int?
init () {}
func Clone<myColor>() -> myColor {
let newColor = myColor()
newColor.red = self.red
newColor.green = self.green
newColor.blue = self.blue
return newColor
}
}
The error is on line:
let newColor = myColor()
Type 'myColor' has no member 'init'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With