swiftuiimageswift4pulse

imageview under pulsator with swift 4


I am trying to show an UIImage with pulse effect, for this I use pulsator framework. but the UIImage is under the pulsator, now I want to know if it is possible to set the UIImage on pulsator effect?

This is my code:

let img = UIImage(named: "img_usuario")
let img_view = UIImageView(image: img)
img_view.frame = CGRect(x: 0, y: 0, width: 50, height: 50)
img_view.layer.cornerRadius = img_view.frame.size.height/2
img_view.layer.masksToBounds = true
let pulsator = Pulsator()
pulsator.radius = 50
pulsator.numPulse = 3
pulsator.position = img_view.center
pulsator.backgroundColor = UIColor.rgb(red: 220, green: 5, blue: 5, alpha: 1).cgColor
img_view.layer.addSublayer(pulsator)
pulsator.start()

and I also want to know how I make the effect pulse is exceeds the size of the image like the demo my image

thanks in advance


Solution

  • For this kind of stuff, you should probably submit an issue. You might get a better and quicker answer that way.

    From what I seen in the example, you should do this:

    img_view.layer.superlayer?.insertSublayer(pulsator, below: img_view.layer)
    

    This might just be caused by an outdated README.

    Also, if it does not exceed the image view, try setting the radius to a larger number.