Question 1 of 8 · Criteria · ~8 min · Memory & ARC

Strong vs weak vs unowned references

00:00
What is the difference between strong, weak and unowned references? Use the snippet: why is customer declared unowned and not weak?
swift
final class Customer {
    var card: CreditCard?
}

final class CreditCard {
    unowned let customer: Customer   // why unowned, not weak?
    init(customer: Customer) {
        self.customer = customer
    }
}

Criteria — tap what you hear

Tap a row to cycle: hit → partial → missed → clear

0/5 marked
Rating

0/500