Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Circular reference
class Person{
var name: String
init(name: String) {
print("--- init \(name) ---") = name
deinit {
print("--- deinit \(name) ---")
func normalHello(){
print("Hello, I am \(name)!")
// MARK: - Closure関連
private var keepingClosure:(()->Void)?
private func keepAndDo(_ closure:@escaping (()-> Void)){
self.keepingClosure = closure
// MARK: - Hello系
func strongHello(){
self.keepAndDo {
func weakHello(){
self.keepAndDo { [weak self] in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.