iOS - CAEmitterCell using Swift

684 views Asked by At

I'm trying to create a particle system for an iOS app. the app doesn't use SpriteKit, so i'm using CAEmitterLayer and CAEmitterCell to do it. In Objective - C, i initialized a CAEmitterCell this way:

[CAEmitterCell emitterCell];

but in swift there isn't such initializer. Looking at Swift documentation, there's no method to create and initialize a CAEmmiterCell.

Is there any way of implementing a particle system using CAEmitterCell in Swift?

1

There are 1 answers

0
Judson Douglas On BEST ANSWER

This is how that initialization is done in Swift:

 CAEmitterCell()

If you want to assign it to a variable:

 var emitterCell = CAEmitterCell()

You'll definitely want to read here about how to initialize Objective-C objects with Swift.