Floaty icon indicating copy to clipboard operation
Floaty copied to clipboard

Isn't the [weak self] needed in addItem() ?

Open qsd-faris opened this issue 2 years ago • 0 comments

This is the example of usage of Floaty buttons on this github repo. The code below creates a Floaty button and add on item inside.

let floaty = Floaty()
floaty.addItem("I got a handler", icon: UIImage(named: "icon")!, handler: { item in
    let alert = UIAlertController(title: "Hey", message: "I'm hungry...", preferredStyle: .alert)
    alert.addAction(UIAlertAction(title: "Me too", style: .default, handler: nil))
    self.present(alert, animated: true, completion: nil)
    floaty.close()
})

So my question is, are you sure that we really dont need a [weak self] since the method addItem is having a handler as an escaping closure?

qsd-faris avatar Jan 05 '23 09:01 qsd-faris