<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>IOS on Vincent Germain, Product Engineer in Paris</title><link>https://www.vinzius.com/categories/ios/</link><description>Recent content in IOS on Vincent Germain, Product Engineer in Paris</description><generator>Hugo</generator><language>en-us</language><copyright>Vincent Germain</copyright><lastBuildDate>Sat, 26 Dec 2020 00:00:00 +0000</lastBuildDate><atom:link href="https://www.vinzius.com/categories/ios/index.xml" rel="self" type="application/rss+xml"/><item><title>Automatically dismiss or pop a SwiftUI View when a NSManagedObject is deleted</title><link>https://www.vinzius.com/snippets/automatically-dismiss-or-pop-swiftui-view-when-nsmanagedobject-is-deleted/</link><pubDate>Sat, 26 Dec 2020 00:00:00 +0000</pubDate><guid>https://www.vinzius.com/snippets/automatically-dismiss-or-pop-swiftui-view-when-nsmanagedobject-is-deleted/</guid><description>&lt;p&gt;Managing the screen flow seems to be less flexible with SwiftUI than it is with UIKit. The options are still numerous depending on your application and the chosen architecture (e.g. redux). Here is a trick if you have a NSManagedObject and would like to close the related screen if the object becomes obsolete.&lt;/p&gt;
&lt;p&gt;From experience, it seems that Apple tries to automatically dismiss a screen if one of the &lt;code&gt;@EnvironmentObject&lt;/code&gt; is removed from memory (like &lt;code&gt;NSManagedObject&lt;/code&gt; being « deleted »). However I couldn’t find documentation about this behavior, and it didn’t work all the time (while it did most of the time).&lt;/p&gt;</description></item><item><title>Dismiss modal or pop view inside a XCTest UI test</title><link>https://www.vinzius.com/snippets/dismiss-modal-pop-view-inside-xctest-ui-test/</link><pubDate>Wed, 09 Dec 2020 00:00:00 +0000</pubDate><guid>https://www.vinzius.com/snippets/dismiss-modal-pop-view-inside-xctest-ui-test/</guid><description>&lt;p&gt;When building an UI test, you often need to automatically close the visible modal or pop the view currently stacked. If you use the XCTest framework, then you have to only rely on what is visible on the screen (as if you were an user).&lt;/p&gt;
&lt;figure&gt;
 &lt;a class="lightbox-link"
 href="https://www.vinzius.com/static/2020-12-close-view.png"
 data-lightbox="gallery"
 
 data-caption="Close buttons in navigation bar"
 
 
 &gt;
 &lt;img src="https://www.vinzius.com/static/2020-12-close-view.png"
 alt="Close buttons in navigation bar"
 loading="lazy"
 decoding="async"
 &gt;
 &lt;/a&gt;
&lt;/figure&gt;&lt;center&gt;&lt;i&gt;Close button in quick look modal&lt;/i&gt;&lt;/center&gt;
&lt;h2 id="usual-way"&gt;Usual way&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s say you have a button inside a SwiftUI view.&lt;/p&gt;</description></item></channel></rss>