<分区>
我怎样才能像 a 那样做 new init
Attention: I need init, not static func
extension UIImage {
convenience init?(named: String, in bundle: Bundle? = nil, compatibleWith collection: UITraitCollection? = nil, rendring: UIImageRenderingMode) {
self.init(named: named, in: bundle, compatibleWith: collection)
self = self.imageWithRenderingMode(rendring) // error
return
}
}
但是我在执行时遇到了错误
Error: Cannot assign to value: 'self' is immutable