Emre Esen Emre Esen - 23 days ago 10
Swift Question

LTMorphingLabel Swift4 Error

I get below error.

Cannot convert value of type '(_) -> ()' to expected argument type 'LTEmitterConfigureClosure?' (aka 'Optional<(CAEmitterLayer, CAEmitterCell) -> ()>')

How can i fix it?

self.emitterView.createEmitter(
"fragments",
particleName: "Fragment",
duration: 0.6
) {_ in}.update { (layer, _) in
if progress > end {
layer.birthRate = 0
}
}.play()

Answer Source

Just replace trailing closure {_ in} with configureClosure: nil, ie.

self.emitterView.createEmitter(
                "fragments",
                particleName: "Fragment",
                duration: 0.6,
                configureClosure: nil).update { (layer, _) in
                    if progress > end {
                        layer.birthRate = 0
                    }
                }.play()