Exercise 3: Why "Returns a New Wrapped View" Explains Order-Dependence — Possible Solution ================================================================================================= If a modifier worked by mutating some shared, underlying properties on a single existing view object - the way setting a property directly on a class instance would - then it wouldn't really matter in principle what order two independent property changes were applied in, since they'd both just be edits to the same one real object's final state. But that's genuinely not how SwiftUI modifiers work. Each modifier call takes whatever real view value exists so far and returns a BRAND-NEW view value that wraps it - .padding() doesn't edit the Text it's called on, it produces a new, distinct view whose entire job is "draw this specific view, with padding added around it." The original view being wrapped is treated as a fixed input, not something later modifiers reach back and edit. This is exactly why order matters: .background() applied to a padded-Text-wrapper only ever gets to see and color THAT wrapper - a already-larger, padded view - so the background fills the padded area. .background() applied directly to a plain Text only ever gets to see and color the plain, unpadded text - so it hugs the text tightly, with padding (if applied afterward) wrapping around that already-colored result instead. Each modifier only ever affects the specific view value it was actually called on, at that specific point in the chain - never anything wrapped either before or after it. ANSWER: Because a modifier returns a brand-new view wrapping whatever came before it, rather than mutating a single shared object, each modifier can only ever affect the specific view value it was directly called on at that point in the chain. Swapping the order of two modifiers changes what each one is actually wrapping and therefore affecting - which is exactly why chaining .padding() before versus after .background() produces two genuinely different visual results, not a bug or a coincidence. WHY THIS WORKS AS AN ANSWER ------------------------------ This directly connects the wrap-not-mutate mechanism to the observed order-dependent behavior, explaining the causal link rather than just restating that order matters.