deinit Questions

3

Solved

I added a variable of Timer to my class, and used its didSet observer to invalidate old value var timer: Timer? { didSet { oldValue?.invalidate() } } deinit { timer = nil } I thought this wou...
Clyte asked 15/10, 2018 at 16:1

1

Solved

Starting with ios 9 it is not necessary to unsubscribe from notification center since ios handles this automatically, but prior to ios 9 developers had to manually call NotificationCenter.default.r...
Notation asked 12/2, 2021 at 8:39

5

Solved

I have a view controller that has three skscenes as children. When I transition from one to another, the old skscene doesn't get deallocated. I want it to get deallocated as if it was never there...
Makedamakefast asked 25/2, 2014 at 7:28

13

I'm creating a ViewController object an pushing it to a navigation controller. When the object is being popped from the stack - it is not being release and Deinit is not being called. What can be t...
Caia asked 17/11, 2014 at 11:11

3

Solved

I have a UIView similar to the one you can see below: class ViewTaskViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { override func viewDidLoad() { super.viewDidLoad(...
Ominous asked 12/5, 2017 at 11:5

1

In Swift (I'm using 4.1), is there a way to do some clean-up in an extension when an object is being destructed? I have in mind the kind of code that would go in deinit(), but an extension can't de...
Series asked 13/4, 2018 at 18:17

1

Solved

I would to know if it's possible, in my view controller, use a lazy property and in deinit method call a method of my lazy property only if it was initialized. Below some code: fileprivate lazy va...
Sclerenchyma asked 30/5, 2017 at 10:3

1

the problem is in my project. But I also tried in new xcode draft project that Master-Detail Application one. I have created base Cell class and mapped the cell on storyboard. After delete operat...
Glori asked 19/10, 2015 at 9:8

2

Solved

I am exploring Swift value types particularly structs to get a better understanding of it's uses in different scenario. I was amazed to see how enum can be used to build Binary Search Tree using in...
Fallible asked 4/4, 2017 at 22:5

1

When creating a subclass from another class, it is required to override the init() function, but you cannot override the deinit 'function'. Is this possible in Swift? Here is an example ...
Hass asked 28/10, 2016 at 11:52

2

Solved

I want to define a method that can destroy the instance it belongs to when a variable in this class has increased to a certain value. I attempted to do something like following: var calledTimes =...
Monometallic asked 29/1, 2016 at 4:7

0

I've been struggling on this for a while now, but I wasn't able to find a solution: I've got an iOS 9 app that supports all device families, uses size classes and is programmed with Swift 2.0. I'm...
Loincloth asked 20/10, 2015 at 14:0

1

Solved

private let DBItemCellIdentifier = "ItemCellIdentifier" private let DBItemSegueIdentifier = "ItemSegueIdentifier" class DBItemsViewController: UIViewController, UITableViewData...
Lunik asked 30/7, 2015 at 7:21

2

Solved

Which one happens first? Zeroing (nilling) weak variable. deinit
Lalo asked 2/11, 2014 at 11:41
1

© 2022 - 2024 — McMap. All rights reserved.