Swift is a powerful and intuitive programming language created by Apple for building premium apps for iOS, iPadOS, macOS, watchOS, and tvOS.
class Person {
let name: String
init(name: String) { self.name = name }
var apartment: Apartment?
deinit { print("\(name) is being deinitialized") }
}
class Apartment {
let unit: String
init(unit: String) { self.unit = unit }
weak var tenant: Person? // Avoids Retain Cycle
deinit { print("Apartment \(unit) is being deinitialized") }
}Which keyword prevents strong reference cycles by not increasing an object's reference count?
Register for a completely free demo class. Learn directly from enterprise developers at Dream Adoration.
Get real-world industry training & hands-on experience
Subscribe to receive the latest updates on AI tools, website development, SEO services, digital solutions, internship programs, and technology trends. Get useful learning resources, product updates, and career opportunities directly in your inbox.