class DownloadCounter {
    var count = 0
    var lastDownload: Date?
}

actor DownloadManager {
    private var totalProcessed = 0  // βœ… Protected by actor
    
    func processDownload(_ counter: DownloadCounter) async {
        totalProcessed += 1           // βœ… Safe - actor's state
        
        // πŸ’₯ DANGER: counter is NOT protected!
        counter.count += 1            // ❌ Potential data race
        counter.lastDownload = Date() // ❌ Potential data race
    }
}

// Data race scenario
func dangerousUsage() async {
    let counter = DownloadCounter()
    let manager = DownloadManager()
    
    // Thread 1
    Task {
        await manager.processDownload(counter)
    }
    
    // Thread 2 - Concurrent access!
    Task {
        counter.count += 5  // πŸ’₯ DATA RACE with Thread 1
    }
}

βœ… The Solution: sending to Transfer Ownership

actor DownloadManager {
    private var totalProcessed = 0
    
    func processDownload(_ counter: sending DownloadCounter) async {
        totalProcessed += 1
        
        // βœ… Safe now - counter belongs exclusively to me
        counter.count += 1
        counter.lastDownload = Date()
    }
}

func safeUsage() async {
    let counter = DownloadCounter()
    let manager = DownloadManager()
    
    await manager.processDownload(counter)
    // counter is no longer accessible here βœ…
}

πŸ’‘ Tip: When passing a mutable object to an actor, ask yourself: “Who else can access this?” If the answer isn’t “nobody”, use sending or a safe alternative!