<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 17.0px '.SF UI Text'; color: #454545}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 17.0px '.SF UI Text'; color: #454545; min-height: 20.3px}
li.li1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 17.0px '.SF UI Text'; color: #454545}
span.s1 {font-family: '.SFUIText-Regular'; font-weight: normal; font-style: normal; font-size: 17.00pt}
ol.ol1 {list-style-type: decimal}
</style>


<p class="p1"><span class="s1">Hi Guys</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">I would like to propose a small addition. Please have a look at following and let me know your thoughts -</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Proposal : Introduction of System Defined UI Variables - ScreenSize, IsPad.</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Motivation : All of us know that we have a pretty good set of methods that can provide us this information. UIScreen is there to provide this. But when the app supports autorotation, in landscape, it's width becomes height and vice-versa, leaving developer to figure out what the current width and height is.</span></p>
<p class="p1"><span class="s1">This forces developer to write some lines of unnecessary code every time an app starts supporting autorotation. If we had system defined variables, we could easily rely on them, regardless of current orientation.</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Use Case : When app receives an autorotation event, we need to perform changes to our UI accordingly where it needs these ScreenSize(updated) &amp; IsPad variables.</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Note : Everybody is aware that -</span></p>
<ol class="ol1">
<li class="li1"><span class="s1">Autolayout takes care of the most issues down this line.</span></li>
<li class="li1"><span class="s1">Calculations(on mere change of orientation) are rarely needed when you correctly use Autolayout.</span></li>
</ol>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">But we can never rule out the possibility. A system defined variable comes to quick rescue.</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Does it go along Swift's Evolution?</span></p>
<p class="p1"><span class="s1">Obviously, a short and smart addition to developer toolkit.</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Does it break any existing code?</span></p>
<p class="p1"><span class="s1">Absolutely No.</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Advantages : A lot of unnecessary code can be abstracted from user providing a clean interface that facilitates the needed info (updated to current orientation) using a reliable system variable.</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Has it been considered before?</span></p>
<p class="p1"><span class="s1">Yes, revised autorotation approach (Adaptive)</span></p><p class="p1"><span class="s1"><br></span></p>
<p class="p1"><span class="s1">func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator)</span></p><p class="p1"><span class="s1"><br></span></p>
<p class="p1"><span class="s1">is a place to look at. Yes, it specifically handles the use case that I described above. But does it eliminate the need of ScreenSize? Not Completely.</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">It gets along with a super smart language Swift's evolution direction and should be welcomed by most of the developers.</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Let me know your thoughts.</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Thanks!</span></p>


</div><div><br></div><div id="AppleMailSignature">Tarun.</div></body></html>