<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rita Lytvynenko on Medium]]></title>
        <description><![CDATA[Stories by Rita Lytvynenko on Medium]]></description>
        <link>https://medium.com/@popcornomnom?source=rss-7a5f8c43a46------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MPixTMJtqkAjw1MUJ1j5JQ@2x.jpeg</url>
            <title>Stories by Rita Lytvynenko on Medium</title>
            <link>https://medium.com/@popcornomnom?source=rss-7a5f8c43a46------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 16:53:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@popcornomnom/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Basic Typography Design System for Swift and SwiftUI]]></title>
            <link>https://medium.com/better-programming/a-basic-typography-design-system-for-swift-and-swiftui-8ee026247c05?source=rss-7a5f8c43a46------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ee026247c05</guid>
            <category><![CDATA[fonts]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Rita Lytvynenko]]></dc:creator>
            <pubDate>Tue, 10 Sep 2019 21:27:42 GMT</pubDate>
            <atom:updated>2019-11-12T22:52:44.966Z</atom:updated>
            <content:encoded><![CDATA[<h4>Boost consistency and scalability with central font management</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C0BMPcdhWOcTH_8h.jpg" /><figcaption>Photo by <a href="https://unsplash.com/@alex_andrews?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Alexander Andrews</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Today every highly qualified team with streamlined design processes should have its own design system that includes colors, typography, icons, etc.<br>In this article, I’ll show you how to make a basic typography design system in iOS app using Swift.</p><h3>Why Do You Need a Typography System?</h3><h4><strong>Consistency</strong></h4><p>Every modern company has a typography system (set of predefined text styles) that’s used across different platforms or within one platform to provide a consistent experience to its users. It’s much easier for a user to process six or seven text styles that create a visual hierarchy on the screen in order for them to understand key parts of the content.</p><h4>Scalability</h4><p>Nothing is constant in this world, and text styles are no exception. At some point, your designer might come up with a genius idea to make all H1s across the app 28pt instead of 26pt or change the font family from San Francisco to Times New Roman. If you have a complex app, this will require you to go over storyboards and classes and manually change them. This is simply not scalable.</p><p>It’s better to have a centralised place where all font management happens. This management should be scalable and easy to understand for new teammates of any professional level.</p><h3>Text Style Structure</h3><p>There are a few main components in text style:</p><ol><li>Text family</li><li>Text weight (styling)</li><li>Text size</li><li>Line height (optional)</li><li>Color (optional)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UezucF8E4kxG82BP.png" /><figcaption>Text style structure</figcaption></figure><p>The first three are the most important, so let’s focus on them.</p><p>If you open Storyboard, you can easily spot these three components:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/0*SxCiLCJ8RbJr54V1.png" /><figcaption>Assign Font in iOS using Storyboard</figcaption></figure><p>By combining these three components, you can create a set of reusable text styles for your app. Usually, it’s done by the designer and there are six or seven different text styles used throughout the app.</p><p>For example, in our project, we have Header 1, Header 2, Header 3, Body L, Body M, and Body S.</p><p>I would suggest you align with the designer on naming and use the same names as they use in designs. This will simplify your communication and keep you on the same wavelength.</p><h3>Create the Font Manager</h3><p>It’s time to go to the point.</p><p>First of all, create a file where you’ll manage your fonts (for example, FontManager).</p><p>To avoid confusion with the string values of the font names, create enums for the font family, weight, and style.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1d15b66363dcd63122a346aae1e79a9/href">https://medium.com/media/a1d15b66363dcd63122a346aae1e79a9/href</a></iframe><p>The method described below returns the font name from the family and weight parameters.</p><p>Below I’ve added this code to FontManager file scope.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec37300170f1a6ca4d4f2024b1d289b8/href">https://medium.com/media/ec37300170f1a6ca4d4f2024b1d289b8/href</a></iframe><p>stringName method provides you the option to list incompatible Font Family and Weight. (For example, Inter has no Heavy Weight)</p><p>Important: Before adding a new font, check what weights are available for this font family: UIFont.familyNames.map { UIFont.fontNames(forFamilyName: $0) }. Otherwise, you will get an exception or incorrect font for incompatible font families and weights in the future.</p><p>It’s time to update your code and put everything together:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/62a205023006256a27be9363f83dee04/href">https://medium.com/media/62a205023006256a27be9363f83dee04/href</a></iframe><p>Furthermore, I added a default font family (in case your app should have only one). But sometimes your app is required to support more than one font family.</p><h3>Update for Swift UI</h3><p>If you’re already started transitioning toSwiftUI, add the code above to the bottom of the FontManager file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3656d68f558f4915b8c3885b1dc2e61a/href">https://medium.com/media/3656d68f558f4915b8c3885b1dc2e61a/href</a></iframe><p>Easy peasy!</p><h3>Usage</h3><p>To illustrate the simplicity of usage, check how easy it is to assign a new font to UIKit elements using Swift:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fc67bca9f69f937d1c4c297aea9f590/href">https://medium.com/media/5fc67bca9f69f937d1c4c297aea9f590/href</a></iframe><p>SwiftUI:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b10f93dff4f854d6325f89892a7f619/href">https://medium.com/media/0b10f93dff4f854d6325f89892a7f619/href</a></iframe><h3>Optional Improvement</h3><p>Moreover, you can add your most-used font style in the UIFont extension (or Font extension for SwiftUI)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f779fa7ac029953d743b849ed776cef4/href">https://medium.com/media/f779fa7ac029953d743b849ed776cef4/href</a></iframe><p>From iOS 13.0 on, Apple added the Own typography system.<br>To use custom Own, override existing typography:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f779fa7ac029953d743b849ed776cef4/href">https://medium.com/media/f779fa7ac029953d743b849ed776cef4/href</a></iframe><h3>Recap</h3><p>And lastly, in my case, the whole typography system is 70 lines!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Mwfsrz-CEiuQyNVe.png" /><figcaption>Basic typography design system in iOS app using Swift / SwiftUI</figcaption></figure><p>Thanks for your time. I hope you learned something new from this piece. <br>You can <a href="https://gist.github.com/popcornomnom/e7c3f5e792627ad0423ba9ee1c2f7641">download the gist</a> from GitHub.</p><p>Written with ❤️ by Rita.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ee026247c05" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/a-basic-typography-design-system-for-swift-and-swiftui-8ee026247c05">A Basic Typography Design System for Swift and SwiftUI</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling Internet Connection reachability in iOS (Swift 5)]]></title>
            <link>https://medium.com/@popcornomnom/handling-internet-connection-reachability-on-ios-swift-5-2a5cc68fb4b7?source=rss-7a5f8c43a46------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a5cc68fb4b7</guid>
            <category><![CDATA[reachability]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Rita Lytvynenko]]></dc:creator>
            <pubDate>Sun, 24 Mar 2019 20:25:42 GMT</pubDate>
            <atom:updated>2019-08-19T11:40:10.245Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pkwvFpkI8NYzY9zG8VDyaQ.png" /></figure><p><em>This article was originally posted at </em><a href="http://www.popcornomnom.com/create-a-stopwatchcountdown-for-ios-using-swift-5/"><strong><em>http://popcornomnom.com/</em></strong></a></p><h3>Intro</h3><p>Today, more and more applications require an internet connection. I will cover handling internet connection reachability on iOS using Swift 5 in this article.</p><p><strong>Showing network connection status helps user to understand if something went wrong.</strong> In most of cases just showing spinner is not enough (it doesn’t indicate that network is down). Especially if loader keep spinning more than a few minutes. Whether it is a problem with the server, loss of internet connection or a problem on the device.</p><p><strong>Showing more details and information about network status helps user to understand that there is a problem with connection, fix this problem (if user can) or retry later.</strong></p><p>For integration of this approach you will need 1–2 minutes.</p><h3>Problem</h3><p>Handle the problem with the internet connection and display warning alert to user or make new query when connection will restore.</p><h3>Solution</h3><p>For this purpose, I use <a href="https://github.com/ashleymills/Reachability.swift">Reachability</a> library.</p><h4>Step 1: Install Reachability.swift</h4><p>To install Reachability.swift with <a href="https://cocoapods.org/"><strong>CocoaPods</strong></a>:</p><p><strong>1.</strong> Make sure CocoaPods is <a href="https://guides.cocoapods.org/using/getting-started.html#getting-started">installed</a>.<br><strong>2.</strong> Update your Podfile to include the following:</p><pre>use_frameworks! <br>pod &#39;ReachabilitySwift&#39;</pre><p><strong>3.</strong> Run pod install.</p><p>If you are (for whatever reason) not using CocoaPods you can install Reachability.swift with <a href="https://github.com/Carthage/Carthage"><strong>Carthage</strong></a> or <strong>manually.</strong></p><h4>Step 2: Handle connection changes</h4><p>Create ReachabilityObserverDelegate</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f04b4d54f649cf914a08a9d4a5f991d4/href">https://medium.com/media/f04b4d54f649cf914a08a9d4a5f991d4/href</a></iframe><p>I have created an extension with the default declaration of addReachabilityObserver and removeReachabilityObserver where an object that adopt ReachabilityObserverDelegate protocol subscribes/unsubscribes internet reachability. Unlike reachabilityChanged, which requires implementation (and is responsible for handling).</p><h4>Step 3: Usage of ReachabilityObserverDelegate</h4><p>It’s easy to integrate into different classes and projects.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3034bd7aacb29cb44bd51f71d35a2a71/href">https://medium.com/media/3034bd7aacb29cb44bd51f71d35a2a71/href</a></iframe><h3>Recap</h3><p>Example of usage in app:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/0*Lhlzot4pqCdfUDTf.gif" /><figcaption>internet connection loss in application</figcaption></figure><p>Thanks for the reading. I hope you learned how to handle internet connection status from this article. You can download <a href="https://gist.github.com/popcornomnom/aa06d98f8d9834101a634f358e524660"><strong>gist</strong></a></p><p>Check my previous articles on <a href="http://www.popcornomnom.com/swift-tutorial-how-to-create-own-xcode-file-template-for-ios-and-macos/"><strong>how to create own custom xCode Template</strong></a> or <a href="http://www.popcornomnom.com/ios-localization-swift-5/"><strong>iOS Localization Advices (Swift 5)</strong></a>.</p><p>You might also <a href="https://itunes.apple.com/us/app/kcalculator-calorie-counter/id1453027511?l=ru&amp;ls=1&amp;mt=8"><strong>view my app</strong></a> and how I used approach described above.</p><p>If you have any questions or spot any errors please let me know.</p><p>Written with ❤️ by Rita</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a5cc68fb4b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create own xCode File Template for iOS and MacOS]]></title>
            <link>https://medium.com/@popcornomnom/swift-tutorial-how-to-create-own-xcode-file-template-for-ios-and-macos-d2e535ed62c5?source=rss-7a5f8c43a46------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2e535ed62c5</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[file-templates]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Rita Lytvynenko]]></dc:creator>
            <pubDate>Thu, 28 Feb 2019 20:50:28 GMT</pubDate>
            <atom:updated>2019-12-13T16:12:46.463Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to create own xCode File Template for iOS and MacOS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SnNJwtSMipXnVFDXEIB5Ag.png" /><figcaption>custom xCode File Template for iOS and MacOS</figcaption></figure><p><em>This article was originally posted at </em><a href="http://www.popcornomnom.com/create-custom-xcode-file-template-for-ios-and-macos-swift-5/"><strong><em>http://popcornomnom.com/</em></strong></a></p><p>Like any developer who has written more than one project, you often create a similar files or copy already written code from previous projects over again. But if you heard anything about custom xCode file template you would know how it can do your life easier.</p><p>Thus sometimes you should set aside time once to avoid routine in future.</p><p>This article should explain how to create your own xCode File Template.</p><p>If you don’t want to dive deep you can download template <a href="https://github.com/popcornomnom/Extension-FileTemplate"><strong>here</strong></a> and just use it</p><h3>Solution</h3><h4>Explore native xCode’s templates</h4><p>First of all, I recommend to explore native xCode’s templates. Open Finder window and press Cmd+Shift+G (or Go → Go To Folder option in MenuBar)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*SOFV6NinNf2rnmYq_EGA7A.png" /><figcaption>Go to the folder window</figcaption></figure><p>Then paste the way:</p><p><strong>For iOS: </strong><br>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File Templates/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CUUUoR1AT_AenZ1l3FEMmw.png" /><figcaption>Native xCode’s templates for iOS</figcaption></figure><p><strong>For macOS X:</strong><br>/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Source</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3i8NuNjgVnWYywb3Fkw3DA.png" /><figcaption>Native xCode’s templates for macOS X</figcaption></figure><h3>Template structure</h3><p>So, (as you can see in native folders), all templates have .xctemplate file extension. Name of this folders are displayed as name of template in xCode window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1LTq2YveC0-c5HY77aGmTw.png" /><figcaption>New file.. dialog Window</figcaption></figure><h4>Required files in .xctemplate folder</h4><p>Each file template folder must contain at least 3 files (for describing in templates window):</p><ul><li>TemplateInfo.plist - responsible for describing the template window</li><li>TemplateIcon.png - icon shown in the Xcode in New file dialog window</li><li>___FILEBASENAME___.swift - the actual template file what will be created. Template file can be any another type (.swift, .h, .m, .xib, .storyboard...). Of course, you can create more than one. (For example, Cocoa Touch Class can create two files at once: subclass of UIViewController with .xib file)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0nkZQWXI0rvHEp-o4e9rng.png" /><figcaption>For example ‘Swift file’ template</figcaption></figure><h4>Required fields in TemplateInfo.plist</h4><ul><li><strong>Kind</strong> (type: <em>string</em>) (The name speaks for itself) For ‘File Template’ it’s Xcode.IDEKit.TextSubstitutionFileTemplateKind</li><li><strong>Description</strong> (<em>string</em>)</li><li><strong>DefaultCompletionName</strong> (<em>string</em>) the default name of file (without extension).</li><li><strong>SortOrder</strong> (<em>number</em>) used to rearrange the order in a category.</li><li><strong>Summary</strong> (<em>string</em>)</li></ul><h4>Optional fields in TemplateInfo.plist</h4><ul><li><strong>Platforms</strong> (<em>array</em>) By default the template will be available for all platforms. If you want your template only for one platform you should define this (com.apple.platform.iphoneos, com.apple.platform.macosx)</li><li><strong>MainTemplateFile</strong> (<em>string</em>) In case a template has more than one file, MainTemplateFile specify which file should be opened first after template’s files has been created.</li><li><strong>DefaultCompletionName</strong> (<em>string</em>)</li><li><strong>Options</strong> (<em>array</em>) determine the options what you can configure in the first step of creating a new File.</li></ul><h4>Few possible Options keys for generating own creating new file window</h4><p>If you decide configure own “Choose options..” window you should get to know about Options. If your .plist have no Options, “Choose options..” will be skipped.</p><p>Primary item that you must add, is an option (with text type) with Identifier ‘productName’. Otherwise, the future file won’t be created.</p><ul><li><strong>Default</strong> (<em>string</em>) selection or text.</li><li><strong>Description</strong> (<em>string</em>) of option. You can see the text when the mouse hovers over the option.</li><li><strong>Identifier</strong> (<em>string</em>) are used to uniquely identify options. You can use them for creating references for using in other options or template file.</li><li><strong>Name</strong> (<em>string</em>) Text is shown on the left side of the control.</li><li><strong>Required</strong> (<em>bool</em>) — determinate is option a required. If a Required option does not have a valid value the Next button on dialog window will be unavailable.</li><li><strong>SortOrder</strong> (<em>number</em>) determinate position of option. By default they are displayed in the same order as their position in the Options array.</li><li><strong>Type</strong> (<em>string</em>) of option. Eg checkbox, text, static, combo box, popup.<br>NotPersisted (<em>bool</em>) determinate is the value that will be saved for the next time.<br><strong>RequiredOptions</strong> (<em>dictionary</em>) are referenced an another options required values, otherwise, its option is grayed out.<br><strong>Values</strong> (array) using for defining option of combo box.</li></ul><h3>Creating own template</h3><p>First of all, you should create a folder for your template.</p><p>It’s not recommended to modify existing Apple’s templates or create your own custom templates in the same location as native templates. Consequently, you have to create the folders where you can put own custom Templates (named “File Templates” and “Project Templates” respectively). By default, the folder doesn’t exist on your system.</p><p>You have two ways to do this:</p><ul><li>Using Finder open ~/Library/Developer/Xcode/Templates/File Templates/, then create new folder (in this article it&#39;s named &quot;My templates&quot;)</li><li>Open Terminal and do next command: mkdir -p ~/Library/Developer/Xcode/Templates/File\\ Templates/My templates</li></ul><p>As I mentioned above it is suitable for both platforms (iOS and macOS X).</p><p>Result should be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nByCNG7PZUMr4vjngaloRw.png" /><figcaption>Created folder</figcaption></figure><p>Then, download template example from <a href="https://github.com/popcornomnom/Extension-FileTemplate">here</a> and put template folder into ‘My templates’. I created folders for both platforms. You should get the next:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zNbqADuG10_yCeMEYqr6RQ.png" /><figcaption>Custom file template hierarchy</figcaption></figure><p>As I said before, Name of folder (screenshot above) contained your template is a category name which will be displayed in section of creating new file window (screenshot below). It means you can create your own folders hierarchy.</p><p>In our case it’s “Helpers” folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yj4mO4Bn7sqQVIvqHdanOw.png" /><figcaption>Content of ‘Extension’ template folder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SnNJwtSMipXnVFDXEIB5Ag.png" /></figure><p>Next, open TemplateInfo.plist and explore its structure. &quot;Choose options for your new file&quot; window will contain a one class type field (as I understood it&#39;s a subtype of combo box) and one static field, in spite of &#39;Options&#39; has a 3 items. First one is a &#39;productName&#39; item, as I mentioned above, this option affects the name of the file and will not be shown in a template window. Empirically I got that if template contains &#39;class&#39; option, .xctemplate have to contain a folder named as &#39;Default&#39; value of class type option item. In &#39;Values&#39; you can enumerate preferred classes. The last option is static type is a name preview of created file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wZD2yTG9yDDVwbaxsjGQvw.png" /><figcaption>IOS template’s ‘TemplateInfo.plist’</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eC69IahRPmhzGzA2vMkiXQ.png" /><figcaption>macOS X template’s ‘TemplateInfo.plist’</figcaption></figure><h3>What about template file?</h3><p>As I mentioned previously, template file can be any allowed type.</p><p>You can use text macros and the Option Identifier key to create a Variable Placeholder which will be replaced by the relative text.</p><p>Full list of all macros is available <a href="https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev7fe737ce0">here</a></p><p>Example of using variables macros:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c2df045e68a0f130aa2e2d0edd3c485/href">https://medium.com/media/4c2df045e68a0f130aa2e2d0edd3c485/href</a></iframe><p>Here you can see ___VARIABLE_subclassName___ that defined in .plist</p><h3>Result / how to use</h3><p>An image below illustrates “Choose options for new file” window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SnNJwtSMipXnVFDXEIB5Ag.png" /></figure><p>This is how created file looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lYpXvjNl1t-Ed0rL19igFw.png" /><figcaption>Created file</figcaption></figure><h3>Conclusion</h3><p>One common reason to spend time on creating xCode Templates is usage Design Patterns which requires creating a lot of files at once and setting up references between them.</p><p>Also you can create Project Templates for setup new needed files and directories for new projects.</p><p>That’s it, about creating custom xCode File Template. I hope you learned something useful from this article.</p><p><strong>Source code:</strong></p><p><a href="https://github.com/popcornomnom/Extension-FileTemplate">popcornomnom/Extension-FileTemplate</a></p><p><strong>Check my other articles:</strong></p><p>● <a href="http://www.popcornomnom.com/handling-internet-connection-reachability-on-ios-swift-5/">Handling Internet Connection reachability in iOS (Swift 5)</a></p><p>● <a href="http://www.popcornomnom.com/ios-localization-swift-5/">iOS Localization Advices (Swift 5)</a></p><p>●<a href="http://www.popcornomnom.com/swift-tutorial-how-to-configure-a-nsscrollview-with-horizontal-direction-using-autolayout-in-interface-builder-macos-x-swift-4-2/"> How to create a NSScrollView with horizontal direction using AutoLayout</a></p><p>If you love reading you may <a href="https://itunes.apple.com/us/app/reado-book-library-tracker/id1451104289"><strong>check my app</strong></a>.</p><p>If you have any questions or spot any errors please let me know.</p><p>Thanks <a href="http://miloskiy.com/"><strong>Miloskiy</strong></a> for template icon.</p><p>Written with ❤️ by Rita</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2e535ed62c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a NSScrollView with horizontal direction using AutoLayout in Interface Builder]]></title>
            <link>https://medium.com/@popcornomnom/swift-tutorial-how-to-configure-a-nsscrollview-with-horizontal-direction-using-autolayout-in-bb29abc5a782?source=rss-7a5f8c43a46------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb29abc5a782</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[interface-builder]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[autolayout]]></category>
            <dc:creator><![CDATA[Rita Lytvynenko]]></dc:creator>
            <pubDate>Sat, 01 Dec 2018 09:13:04 GMT</pubDate>
            <atom:updated>2019-08-19T11:40:39.602Z</atom:updated>
            <content:encoded><![CDATA[<h3>Swift tutorial: How to configure a NSScrollView with horizontal direction using AutoLayout in Interface Builder (MacOS X, Swift 4.2)</h3><p><em>This article was originally posted at </em><a href="http://www.popcornomnom.com/swift-tutorial-how-to-configure-a-nsscrollview-with-horizontal-direction-using-autolayout-in-interface-builder-macos-x-swift-4-2/"><strong><em>http://popcornomnom.com/</em></strong></a></p><p>Hello there! Not so long time ago I’ve started writing the application for MacOS (I have IOS development background) and faced the problem that most of the answers on my questions were:</p><ul><li>outdated (answered more than 3 years ago, and consequently, some features were already deprecated)</li><li>(some answers on Objective C were a little bit painful for my “swifty” eye),</li><li>answers were for iOS, not for OS X</li></ul><p>and sometimes finding of a needed answer is harder than it should be.<br>So I decided to start writing step-by-step swift tutorials (simple tutorials in format question-answer).</p><h4>Problem</h4><p>Content doesn’t fit application window and being cut by view controller.</p><h4>Solution</h4><p>To fix this problem you need to add constraints to your views to reach a dynamic width and height of the content.</p><p>Okay, let’s start!</p><h4>Step 1–3.</h4><p>(Step 1 — on an image below) First of all drag NSScrollView to your ViewController. Then at the left panel in “Attributes Inspector” select (2)”Border Type” — none and (3) uncheck “Draw background”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VtbwTuh3M0cncTrsok_IoQ.png" /></figure><h4>Step 4.</h4><p>After, add top/bottom/leading/trailing constraints related to superview. I set a top constraint to 20 because my NSWindow “Full Size Content View” = true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bPZbNMogKyNWawZV51NlKw.png" /></figure><h4>Step 5.</h4><p>Then add your content view(s) (in my case those are 2 Labels wrapped by NSStackView).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*loFYMQexuqC2zgoDbXcoZA.png" /></figure><h4>Step 6.</h4><p>Next let’s add the top, leading, trailing constraints and add two bottom constraints to your contentView. I set all constants to 24.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WATIGT7sDs7-OOaMyYsv5A.png" /></figure><h4>Step 7–8.</h4><p>Then (7) change first bottom offset <strong>relation</strong> to <strong>Less Than or Equal (≤)</strong> and set <strong>priority</strong> to <strong>490</strong>, (8) for the second bottom offset <strong>relation</strong> — <strong>Greater Than or Equal (≥)</strong>, <strong>priority</strong> to <strong>510</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nZ91rgHQhYd0cK1ZdVg0YQ.png" /></figure><h4>Step 9.</h4><p>(9) In addition to that, I added a minimum contentView width 500 (<strong>width constant</strong> = <strong>500</strong> with <strong>relation Greater Than or Equal</strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PIftLilbPKnvdlvuyN-4BQ.png" /></figure><h4>Step 10–11.</h4><p>For documentView of scrollView add the top, leading, two trailing and two bottom constraints. (10) Set first trailing offset <strong>relation</strong> as <strong>Less Than or Equal</strong> and set <strong>priority</strong> to <strong>510</strong>, for second <strong>relation</strong> — <strong>Greater Than or Equal</strong>, <strong>priority</strong> to <strong>490</strong>. (11) And do the same for bottom constraints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AdOzRA7g7Sz_wrfLhn6Pww.png" /></figure><h4>Step 12.</h4><p>At last, you should change the isFliped property to a true value for NSClipView.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a10a4e71ee16da79eaba2d8ea933fb19/href">https://medium.com/media/a10a4e71ee16da79eaba2d8ea933fb19/href</a></iframe><h3>Result</h3><p>Consequently, we have a simple application with dynamic content size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*g-gGzsPQ5f15dbQwn5bxVg.gif" /><figcaption>NSScrollView with horizontal scroll</figcaption></figure><p>That’s it.<br>I hope this article was helpful to you.<br>Source code:</p><p><a href="https://github.com/popcornomnom/ScrollView-Tutorial">popcornomnom/ScrollView-Tutorial</a></p><p><strong>Check my other articles:</strong></p><p>● <a href="http://www.popcornomnom.com/swift-tutorial-how-to-create-own-xcode-file-template-for-ios-and-macos/">How to create own xCode File Template for iOS and MacOS</a></p><p>● <a href="http://www.popcornomnom.com/handling-internet-connection-reachability-on-ios-swift-5/">Handling Internet Connection reachability in iOS (Swift 5)</a></p><p>● <a href="http://www.popcornomnom.com/ios-localization-swift-5/">iOS Localization Advices (Swift 5)</a></p><p>If you love reading you may <a href="https://itunes.apple.com/us/app/reado-book-library-tracker/id1451104289"><strong>check my app</strong></a>.</p><p>If you have any questions or spot any errors please let me know.</p><p>Written with ❤️ by Rita</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb29abc5a782" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>