Skip to content

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

@qsd-faris

Description

@qsd-faris

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions