Last active
October 24, 2019 13:31
-
-
Save alladinian/9b49b95f298f4ab25df9db0e9717a73e to your computer and use it in GitHub Desktop.
DONT USE THIS EVER
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import PlaygroundSupport | |
var addresses = Set<String>() | |
class MyCell: UITableViewCell { | |
required init?(coder: NSCoder) { | |
super.init(coder: coder) | |
} | |
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | |
super.init(style: style, reuseIdentifier: reuseIdentifier) | |
let add = "\(Unmanaged.passUnretained(self).toOpaque())" | |
addresses.insert(add) | |
} | |
} | |
class MyController: UITableViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
tableView.register(MyCell.self, forCellReuseIdentifier: "cell") | |
} | |
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return 100 | |
} | |
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |
return 300 | |
} | |
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? MyCell else { fatalError() } | |
return cell | |
} | |
} | |
PlaygroundPage.current.liveView = MyController() | |
print(addresses) | |
print(addresses.count) | |
// Prints 24 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment