How can we resolve it with help of weak or unowned?
class Controller {
private var theString = "Hello," private var whatToDo: ((String) -> Void)! init() { whatToDo = { str in print("(self.theString) (str)") } } func greetings(_ str: String) { whatToDo(str) } deinit { print("removed from memory") }
}
2.1m questions
2.1m answers
60 comments
57.0k users