Pick the fix
Which line uses a macro that actually exists?
Hint 1 of 1
Freestanding macros start with #.
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A #Preview { ContentView() }
Correct. #Preview is a freestanding macro from SwiftUI (Xcode 15+).
Why not the others?
- B
let s = #localized("greeting"). No such macro exists. UseString(localized: "greeting")with a String Catalog. - C
#Observable final class Model {}. Observable is an attached macro, written @Observable. - D
#Codable struct User {}. Codable is a protocol with compiler synthesis, not a macro.