ios_catalogue1-2 Exercise 3: Tag Names and Keys ================================================ cleaned (trim, collapse whitespace) key (cleaned, then folded: case and accents) " Sci-Fi " -> "Sci-Fi" "sci-fi" "sci fi" -> "sci fi" "sci fi" "SCI-FI" -> "SCI-FI" "sci-fi" "Café" -> "Café" "cafe" "cafe" -> "cafe" "cafe" So "Sci-Fi" and "SCI-FI" are one tag; "sci fi" is a DIFFERENT tag ("sci fi" is not "sci-fi": a hyphen is not whitespace); "Café" and "cafe" are the same tag because the key folds accents. Should Café and cafe be the same? Reasonable people disagree. For a personal catalogue most users would want them merged (they are probably the same word typed on different keyboards). The risk is languages where an accent changes the word (e.g. Spanish "año" vs "ano"). If you want accents to count, drop the diacritic option: cleaned(raw).folding(options: [.caseInsensitive], locale: nil) Then "Café" and "cafe" are different tags. context.insert(Tag(name: "SCI-FI")) when "Sci-Fi" already exists: The key "sci-fi" already exists and is marked unique. According to third-party notes on the WWDC23 session, inserting a model with an existing unique value does NOT throw: it updates (upserts) the existing record. If that is right, the existing tag's name could be silently changed to "SCI-FI", which is NOT what the managed tag list wants (the stored spelling should stay as first typed). The safe habit, used in Chapter 7: never insert a tag blindly. Fetch by key first (Tag.key(for:)); insert only when nothing is found. Test this on your own Xcode, because the behaviour came from a secondary source.