{"id":108,"date":"2024-11-09T23:21:24","date_gmt":"2024-11-09T23:21:24","guid":{"rendered":"https:\/\/www.visitnyc.store\/blog\/?p=108"},"modified":"2024-11-12T18:07:33","modified_gmt":"2024-11-12T18:07:33","slug":"confirmation-dialogs-automatically-hide-their-title-in-vision-os","status":"publish","type":"post","link":"https:\/\/www.visitnyc.store\/blog\/confirmation-dialogs-automatically-hide-their-title-in-vision-os\/","title":{"rendered":"Confirmation Dialogs automatically hide their title in Vision OS"},"content":{"rendered":"\n<p>Not sure what they do in iOS, but in Vision OS it seems you have to set the titleVisibility to .visible for .confirmationDialog to show it&#8217;s title.<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.apple.com\/documentation\/swiftui\/view\/confirmationdialog(_:ispresented:titlevisibility:presenting:actions:message:)-1iv4u\">.confirmationdialog documentation<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Without it (defaults to automatic):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Button(\"Label\") { ... }\n.confirmationDialog(\"Are you sure?\", isPresented: $showConfirmation)<\/code><\/pre>\n\n\n\n<p>It doesn&#8217;t show the &#8220;Are you sure?&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"308\" height=\"244\" src=\"https:\/\/www.visitnyc.store\/blog\/wp-content\/uploads\/2024\/11\/Screenshot-2024-11-09-at-6.19.37\u202fPM.png\" alt=\"\" class=\"wp-image-109\" srcset=\"https:\/\/www.visitnyc.store\/blog\/wp-content\/uploads\/2024\/11\/Screenshot-2024-11-09-at-6.19.37\u202fPM.png 308w, https:\/\/www.visitnyc.store\/blog\/wp-content\/uploads\/2024\/11\/Screenshot-2024-11-09-at-6.19.37\u202fPM-300x238.png 300w\" sizes=\"auto, (max-width: 308px) 100vw, 308px\" \/><\/figure>\n\n\n\n<p>The Apple Page for default says: <a href=\"https:\/\/developer.apple.com\/documentation\/swiftui\/visibility\/automatic\">https:\/\/developer.apple.com\/documentation\/swiftui\/visibility\/automatic<\/a><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>For example, some components employ different automatic behavior depending on factors including the platform, the surrounding container, user settings, etc.<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>With it set to visible:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Button(\"Label\") { ... }\n.confirmationDialog(\"Are you sure?\", isPresented: $showConfirmation, titleVisibility: .visible)<\/code><\/pre>\n\n\n\n<p>Now it shows the title on the alert. Wonder why the default is automatic, and then automatic hides the title in vision os? hmm.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"310\" height=\"268\" src=\"https:\/\/www.visitnyc.store\/blog\/wp-content\/uploads\/2024\/11\/Screenshot-2024-11-09-at-6.20.06\u202fPM.png\" alt=\"\" class=\"wp-image-110\" srcset=\"https:\/\/www.visitnyc.store\/blog\/wp-content\/uploads\/2024\/11\/Screenshot-2024-11-09-at-6.20.06\u202fPM.png 310w, https:\/\/www.visitnyc.store\/blog\/wp-content\/uploads\/2024\/11\/Screenshot-2024-11-09-at-6.20.06\u202fPM-300x259.png 300w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Not sure what they do in iOS, but in Vision OS it seems you have to set the titleVisibility to .visible for .confirmationDialog to show it&#8217;s title. .confirmationdialog documentation Without it (defaults to automatic): It doesn&#8217;t show the &#8220;Are you sure?&#8221; The Apple Page for default says: https:\/\/developer.apple.com\/documentation\/swiftui\/visibility\/automatic For example, some components employ different automatic [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.visitnyc.store\/blog\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.visitnyc.store\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.visitnyc.store\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.visitnyc.store\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.visitnyc.store\/blog\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":3,"href":"https:\/\/www.visitnyc.store\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":149,"href":"https:\/\/www.visitnyc.store\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions\/149"}],"wp:attachment":[{"href":"https:\/\/www.visitnyc.store\/blog\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.visitnyc.store\/blog\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.visitnyc.store\/blog\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}