<?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[Swift Programming - Medium]]></title>
        <description><![CDATA[The Swift Programming Language - Medium]]></description>
        <link>https://medium.com/swift-programming?source=rss----5396e0e8bc29---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Swift Programming - Medium</title>
            <link>https://medium.com/swift-programming?source=rss----5396e0e8bc29---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 13:28:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/swift-programming" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[SwiftUI — You got this! Learn to build your first app — Part 1 of 3]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swift-programming/swiftui-you-got-this-learn-to-build-your-first-app-part-1-of-3-56c8b918dc0a?source=rss----5396e0e8bc29---4"><img src="https://cdn-images-1.medium.com/max/800/1*fhUV3cKalptc4FmyoSnNHw.png" width="800"></a></p><p class="medium-feed-snippet">SwiftUI is Apple&#x2019;s new framework for making user interfaces. If you have ever built a web application using a declarative framework like&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/swift-programming/swiftui-you-got-this-learn-to-build-your-first-app-part-1-of-3-56c8b918dc0a?source=rss----5396e0e8bc29---4">Continue reading on Swift Programming »</a></p></div>]]></description>
            <link>https://medium.com/swift-programming/swiftui-you-got-this-learn-to-build-your-first-app-part-1-of-3-56c8b918dc0a?source=rss----5396e0e8bc29---4</link>
            <guid isPermaLink="false">https://medium.com/p/56c8b918dc0a</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[mobile-apps]]></category>
            <dc:creator><![CDATA[Keith Elliott (keithelliott.co)]]></dc:creator>
            <pubDate>Sat, 02 May 2020 13:33:09 GMT</pubDate>
            <atom:updated>2020-05-02T13:33:09.722Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Design patterns by Tutorials — The power of OOP (part 2)]]></title>
            <link>https://medium.com/swift-programming/https-medium-com-hitendrahckr-part-2-singletone-desing-pattern-in-swift-by-tutorials-the-power-of-oop-431314237b10?source=rss----5396e0e8bc29---4</link>
            <guid isPermaLink="false">https://medium.com/p/431314237b10</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[swift-5]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[singleton-pattern]]></category>
            <dc:creator><![CDATA[Hitendra Solanki]]></dc:creator>
            <pubDate>Thu, 04 Apr 2019 09:40:15 GMT</pubDate>
            <atom:updated>2025-03-17T08:59:12.084Z</atom:updated>
            <content:encoded><![CDATA[<h3>Design patterns by Tutorials — The power of OOP (part 2)</h3><h4>Singleton Pattern: pure-singleton and semi-singleton design pattern in Swift</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0hpH6H37Ou6ukUPPdaJSQ.jpeg" /></figure><p>Prerequisites — This blog series requires an intermediate level of expertise in object-oriented programming. You should have basic knowledge about class, object, constructor, inheritance, value and reference type. An Intermediates will gain knowledge and experts will sharpen his or her knowledge by reading this series from start to finish.</p><h4>Read more blogs here <a href="https://hitendrasolanki.com/">https://hitendrasolanki.com/</a></h4><p><a href="https://hitendrasolanki.com/">Hitendra Solanki - Seasoned Mobile Engineer, AI Enthusiast</a></p><p>Let’s dive in! 🚀</p><h4>Singleton class</h4><p>In object-oriented programming, a singleton class is a class that can have only one object during the whole life-cycle of an application or project.</p><p>Singleton design pattern is a part of iOS Applications life-cycle code. For example, in an iOS project, the <strong>UIApplication</strong> class is the best example of a singleton class, which is created by the iOS system on app launch and passed to the AppDelegate as a parameter in application(_:didFinishLaunchingWithOptions:)method.</p><h4>There are two types of Singleton design patterns.</h4><ol><li>Pure-singleton design pattern</li><li>Semi-singleton design pattern</li></ol><h4>Pure-Singleton Design Pattern:</h4><ul><li>In this pattern, a programmer who is using the functionality of a pure-singleton class is not allowed to create an instance of the class. A programmer can only call methods and access properties available for the singleton class by using the predefined instance of that class.</li><li>The object of a pure-singleton class is automatically created during application launch with pre-defined parameters mentioned by the developer who created that class.</li><li>Pure-singleton classes must be marked as final to avoid inheritance confusion. In swift, you can use structure also to achieve the same concept.</li><li>A programmer cannot inherit the pure-singleton class. When you try to inherit any class in swift, you must call the constructor of the superclass. Calling the constructor of the superclass is not possible in pure-singleton class because all constructors of the pure-singleton class are always marked as <em>private</em>.</li></ul><p>Let understand this design pattern in a simple way with below example.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/684256653b78ec1f5552823739e77747/href">https://medium.com/media/684256653b78ec1f5552823739e77747/href</a></iframe><ul><li>In the above example, <a href="https://gist.github.com/hitendradeveloper/ae404a8b7801c7b24079abbcc7c562f6#file-puresingletondesignpatterexample1-swift">PureSingletonDesignPatterExample1.swift</a> we have marked all <em>init </em>methods as <em>private</em> of <strong>LogManger </strong>class so no one can create an instance of that class. If we try to create a sub-class of LogManger, the compiler will give you an error.</li></ul><p>UIApplication, AppDelegate are examples of the pure-singleton class. Have you ever tried to create an object of UIApplication class manually? Try to do so and run the app. [What happened? App crashed, right? -I have tested this crash on swift 5, XCode 10.2]</p><h4><strong>Limitations of Pure-Singleton Design Pattern,</strong></h4><p>We cannot test the pure-singleton class with the test data. In the above example <a href="https://gist.github.com/hitendradeveloper/ae404a8b7801c7b24079abbcc7c562f6#file-puresingletondesignpatterexample1-swift">PureSingletonDesignPatterExample1.swift</a>, suppose you want to test the LogManager class by pointing it to some test mode URL instead of production mode URL, we can not do that when we are writing test cases in XCTest target.</p><p>We can overcome this limitation by converting our pure-singleton class to semi-singleton class or by using the dependency injection pattern. I will write a dedicated article on dependency injection pattern. For now, let’s continue with the semi-singleton design pattern.</p><h4>Semi-singleton design pattern:</h4><ul><li>In semi-singleton design pattern, a programmer who is using the class is allowed to create an object of the singleton class if required. as well as also allowed to call methods and use properties of the singleton class.</li><li>A programmer can also inherit the semi-singleton class if the singleton is not marked as <em>final</em> by the developer of the singleton class. In semi-singleton design pattern to mark the class as a <em>final </em>is not necessary.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25f78096001ddbdb05037e6bf17d5e80/href">https://medium.com/media/25f78096001ddbdb05037e6bf17d5e80/href</a></iframe><ul><li>In the above example, <a href="https://gist.github.com/hitendradeveloper/0ec691dfa2ad2f97632e611870d1be59#file-semisingletondesignpatterexample1-swift">SemiSingletonDesignPatterExample1.swift</a>, we have not marked the <em>init </em>method as private, so we can create multiple instances of the semi-singleton class to remove the dependency from the property <strong><em>databaseURLEndpoint</em></strong>.<strong> </strong>Now we can create an object of the LogManger class by using any databaseURLEndpoint value, now our class LogManger follows the semi-singleton pattern.</li></ul><p>UserDefault, FileManager, NotificationCenter are the example of semi-singleton classes. We can use pre-defined shared objects of UserDefault, FileManager, and NotificationCenter which are UserDefault.standard, FileManager.default and NotificationCenter.default.</p><p>The pre-defined object of pure or semi-singleton classes always lives in memory and never destroyed until you close the application. A programmer-defined object of semi singleton class destroyed after the scope of the object is completed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*w0sicbjQLHeGKdmhAFKgkA.jpeg" /></figure><blockquote>Question: Which is a better way, “Pure-singletone design pattern” or “Semi-singleton design pattern”, when I should use the first one and when other one?</blockquote><p>This totally depends on the responsibilities of your class. If you have created singleton class in your project and needs to change some of the properties at some point or if you want to add more responsibilities to the class by adding new methods in future and if you required its test cases also with mock data for newly added methods, you should go with the semi-singleton design pattern.</p><p>If you created your class, you are done with unit testing and want to publish it via a framework or library, you can go with pure-singleton design patterns. Because you created the class and some other developer will use it, so unit testing of your singleton-class is your responsibility before release, not the responsibility of the developer who is using it.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fhitendrasolanki.typeform.com%2Fto%2FgPnJ8D%3Ftypeform-embed%3Doembed%26typeform-medium%3Dembed-oembed%26format%3Djson&amp;display_name=Typeform&amp;url=https%3A%2F%2Fhitendrasolanki.typeform.com%2Fto%2FgPnJ8D&amp;image=https%3A%2F%2Fimages.typeform.com%2Fimages%2F2VWurKeiR4R7&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=typeform" width="900" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0727fdec6674b8606da3ba525bc25d0/href">https://medium.com/media/a0727fdec6674b8606da3ba525bc25d0/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/1*uqvXdNn865Fote0JkkY9Zw.gif" /></figure><p><em>Liked this article?<br>Give claps and show your support.<br></em>It doesn’t cost you anything to clap.</p><h3>Read more blogs here <a href="https://hitendrasolanki.com/">https://hitendrasolanki.com/</a></h3><p><a href="https://hitendrasolanki.com/">Hitendra Solanki - Seasoned Mobile Engineer, AI Enthusiast</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=431314237b10" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-programming/https-medium-com-hitendrahckr-part-2-singletone-desing-pattern-in-swift-by-tutorials-the-power-of-oop-431314237b10">Design patterns by Tutorials — The power of OOP (part 2)</a> was originally published in <a href="https://medium.com/swift-programming">Swift Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alamofire vs URLSession: a comparison for networking in Swift]]></title>
            <link>https://medium.com/swift-programming/alamofire-vs-urlsession-a-comparison-for-networking-in-swift-c6cb3bc9f3b8?source=rss----5396e0e8bc29---4</link>
            <guid isPermaLink="false">https://medium.com/p/c6cb3bc9f3b8</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[alamofire]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[apple]]></category>
            <dc:creator><![CDATA[Antoine van der lee ]]></dc:creator>
            <pubDate>Thu, 04 Apr 2019 01:45:00 GMT</pubDate>
            <atom:updated>2019-04-04T01:45:00.418Z</atom:updated>
            <content:encoded><![CDATA[<p>Alamofire and URLSession both help you to make network requests in Swift. The URLSession API is part of the foundation framework, whereas Alamofire needs to be added as an external dependency. <a href="https://stackoverflow.com/questions/36470840/what-is-the-advantage-of-using-alamofire-over-nsurlsession-nsurlconnection-for-n">Many</a> developers <a href="https://www.reddit.com/r/iOSProgramming/comments/6q24ao/urlsession_vs_alamofire/">doubt</a> whether it’s needed to include an extra dependency on something basic like networking in Swift. In the end, it’s perfectly doable to implement a networking layer with the great URLSession API’s which are available nowadays.</p><p>This blog post is here to compare both frameworks and to find out when to add Alamofire as an external dependency.</p><blockquote>This shows the real power of Alamofire as the framework makes a lot of things easier.</blockquote><h4>What is Alamofire?</h4><figure><img alt="Alamofire - Elegant Networking in Swift" src="https://cdn-images-1.medium.com/max/850/0*_u89whaUg9umY7bC.png" /></figure><p>Where URLSession can be found within the standard Foundation framework, we have to go on <a href="https://github.com/Alamofire/Alamofire">Github to find Alamofire</a>. It’s an open sourced framework and owned by the <a href="https://github.com/Alamofire/Foundation">Alamofire Software Foundation</a>. The framework is very popular as you can read from the stats at the moment of writing this blog post:</p><ul><li>164 contributors</li><li>30K+ stars</li><li>42 million (!!) downloads according to <a href="https://cocoapods.org/pods/Alamofire">CocoaPods stats</a> and 600K+ apps which are using it</li></ul><p>These stats make it one of the most popular Swift frameworks available. It’s a well maintained, often used framework which should make it easier to implement networking into your apps.</p><blockquote>Alamofire is named after the <a href="https://aggie-horticulture.tamu.edu/wildseed/alamofire.html">Alamo Fire flower</a>, a hybrid variant of the Bluebonnet, the official state flower of Texas.</blockquote><h4>Alamofire and URLSession compared</h4><p>I’ve asked my followers on Twitter what they prefer to use: Alamofire or URLSession.</p><h3>Antoine v.d. Lee 🇳🇱 on Twitter</h3><p>Although the URLSession APIs are pretty good nowadays, Alamofire is still very popular (30k stars on Github). For my upcoming blog post, I&#39;d like to know your preference, Alamofire or URLSession?</p><p>It turns out that there is a clear separation between developers who prefer to use Alamofire or URLSession. A big question here is if they only prefer it or whether they actually choose to go with the framework of choice as well.</p><p>Alamofire is being advertised as <em>“Elegant Networking in Swift”</em> which gives away its intention a bit already. It’s a layer on top of URLSession with the goal to make common networking features easier to implement.</p><h4>Features which are easier to implement with Alamofire</h4><p>Alamofire contains a lot of extra logic apart from simply building a networking request. These features can make a difference and can sometimes save you a lot of time compared to building them yourself.</p><p>The list of features advertised on their repository readme is long, from which only a few of them really add unique extra value:</p><ul><li>Certificate pinning. It can take some time to sort this out and build this yourself.</li><li>Requests retrying. When a request fails for example because of an authentication failure, you can easily refresh your authentication token and invoke the same request again without touching the implementation code.</li></ul><p>Apart from these features, the syntax for building up requests is a lot more elegant and easier to use. It saves you from a lot extra code and makes validation and error handling a lot easier.</p><p>Often seen as an advantage is the network reachability manager. However, since iOS 12 we can make use of the new <a href="https://developer.apple.com/documentation/network/nwpathmonitor">NWPathMonitor API</a> as well.</p><h4>Building a network request compared</h4><p>Let’s say we have an API which allows us to create a new board with a title “New York Highlights”. For this, using Alamofire the code is very easy:</p><pre>AF.request(&quot;https://api.mywebserver.com/v1/board&quot;, method: .get, parameters: [&quot;title&quot;: &quot;New York Highlights&quot;])<br>    .validate(statusCode: 200..&lt;300)<br>    .responseDecodable { (response: DataResponse) in<br>        switch response.result {<br>        case .success(let board):<br>            print(&quot;Created board title is \(board.title)&quot;) // New York Highlights<br>        case .failure(let error):<br>            print(&quot;Board creation failed with error: \(error.localizedDescription)&quot;)<br>        }<br>}</pre><p>Doing exactly the same with the URLSession API requires a bit more of work.</p><pre>enum Error: Swift.Error {<br>    case requestFailed<br>}<br><br>// Build up the URL<br>var components = URLComponents(string: &quot;https://api.mywebserver.com/v1/board&quot;)!<br>components.queryItems = [&quot;title&quot;: &quot;New York Highlights&quot;].map { (key, value) in<br>    URLQueryItem(name: key, value: value)<br>}<br><br>// Generate and execute the request<br>let request = try! URLRequest(url: components.url!, method: .get)<br>URLSession.shared.dataTask(with: request) { (data, response, error) in<br>    do {<br>        guard let data = data,<br>            let response = response as? HTTPURLResponse, (200 ..&lt; 300) ~= response.statusCode,<br>            error == nil else {<br>            // Data was nil, validation failed or an error occurred.<br>            throw error ?? Error.requestFailed<br>        }<br>        let board = try JSONDecoder().decode(Board.self, from: data)<br>        print(&quot;Created board title is \(board.title)&quot;) // New York Highlights<br>    } catch {<br>        print(&quot;Board creation failed with error: \(error.localizedDescription)&quot;)<br>    }<br>}</pre><p>This shows the real power of Alamofire as the framework makes a lot of things easier:</p><ul><li>The request is build up within a single initializer</li><li>A URL encoder is encoding parameters by default</li><li>Validation is done inline with a simple one-liner and converts into a strongly typed error if validation fails. The response result enum will return this error inside the failure case.</li><li>A generic completion callback makes it easy to decode the response into our custom Board type</li></ul><p>This only could already be a reason to chose for Alamofire and make your life easier. With using URLSession you’re likely ending up making your own wrapper, which requires maintenance and testing. At first, this might seem to be a better decision compared to adding a new dependency, but as projects evolve it could easily be that your own networking layer evolves and gets more complex.</p><h4>How bad would it be to add Alamofire as a dependency?</h4><p>Let’s make it clear that you have to be careful when adding an external dependency to your project. When it’s not maintained, tested or not used a lot, it can add a possible risk to your project. In the end, you might have to continue the development yourself.</p><p>In the case of Alamofire, you don’t really have to worry about that. The framework is well maintained, tested, and used. The framework is quite small and makes it way more elegant to write network requests.</p><h4>Conclusion: How to make the decision?</h4><p>Alamfore is often compared to <a href="https://github.com/AFNetworking/AFNetworking">AFNetworking</a>, the Objective-C equivalent framework for networking. At the time, networking was a lot harder without the URLsession API which only exists since iOS 7. Therefore, it was way more obvious to chose for a framework like AFNetworking to make your life a bit easier.</p><p>Nowadays, looking at the URLSession APIs available, it’s a lot easier to build up network requests. However, doing so will likely move you towards building your own networking layer on top of URLSession. This layer needs to be tested and can potentially grow towards a more complex layer as your project evolves.</p><p>With that in mind, taking the fact that Alamofire is well maintained and used by a lot of projects, you’re probably saving yourself a lot of hassle and time by adding Alamofire as a dependency.</p><p><em>This blog post is comparing URLSession to Alamofire 5, which is in beta at the moment of writing. You can read more about this release </em><a href="https://forums.swift.org/t/alamofire-5-one-year-in-the-making-now-in-beta/18865"><em>here</em></a><em>.</em></p><p><em>Originally published at </em><a href="https://www.avanderlee.com/swift/alamofire-vs-urlsession/"><em>SwiftLee</em></a><em>.</em></p><p><em>More posts and updates: </em><a href="https://www.twitter.com/twannl"><em>@twannl</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6cb3bc9f3b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-programming/alamofire-vs-urlsession-a-comparison-for-networking-in-swift-c6cb3bc9f3b8">Alamofire vs URLSession: a comparison for networking in Swift</a> was originally published in <a href="https://medium.com/swift-programming">Swift Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clear and searchable logging in Swift with OSLog]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swift-programming/clear-and-searchable-logging-in-swift-with-oslog-eadc97b1a9b8?source=rss----5396e0e8bc29---4"><img src="https://cdn-images-1.medium.com/max/960/0*iZO9-A1t_MT1HZMh.jpg" width="960"></a></p><p class="medium-feed-snippet">Exploring Apple&#x2019;s currently recommended logging approach</p><p class="medium-feed-link"><a href="https://medium.com/swift-programming/clear-and-searchable-logging-in-swift-with-oslog-eadc97b1a9b8?source=rss----5396e0e8bc29---4">Continue reading on Swift Programming »</a></p></div>]]></description>
            <link>https://medium.com/swift-programming/clear-and-searchable-logging-in-swift-with-oslog-eadc97b1a9b8?source=rss----5396e0e8bc29---4</link>
            <guid isPermaLink="false">https://medium.com/p/eadc97b1a9b8</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Andrew Lord]]></dc:creator>
            <pubDate>Thu, 04 Apr 2019 01:43:56 GMT</pubDate>
            <atom:updated>2020-02-07T08:55:32.585Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Memory leaks prevention using an autoreleasepool in unit tests]]></title>
            <link>https://medium.com/swift-programming/memory-leaks-prevention-using-an-autoreleasepool-in-unit-tests-ccd6319979?source=rss----5396e0e8bc29---4</link>
            <guid isPermaLink="false">https://medium.com/p/ccd6319979</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[dealloc]]></category>
            <category><![CDATA[deinit]]></category>
            <category><![CDATA[autoreleasepool]]></category>
            <category><![CDATA[memory-leak]]></category>
            <dc:creator><![CDATA[Antoine van der lee ]]></dc:creator>
            <pubDate>Tue, 08 Jan 2019 15:01:56 GMT</pubDate>
            <atom:updated>2019-01-08T15:01:56.405Z</atom:updated>
            <content:encoded><![CDATA[<p>Memory leaks often happen without notice. Although best practices like using a weak reference to self inside closures help a lot, it’s often not enough to prevent you from finding a certain memory peak during the development of a project.</p><p>We can use memory graph debugging or Xcode Instruments to help find and fix leaked and abandoned memory. This, however, requires us to make it part of our regular workflow to prevent memory leaks from sneaking in.</p><p>Making it easy to test your app for memory leaks prevent us from introducing them without notice. This will not avoid all leaks, but it will decrease the chance at least.</p><h4>Avoiding memory leaks using unit tests</h4><p>Writing a unit test by combining a weak reference with an autoreleasepool makes it easy to verify deallocation. This can be seen as verifying that the deinit of a class is called and the memory is released.</p><p>In the following example, we’re verifying that a view controller is released. By creating an easy to use extension method on XCTestCase you make it easy to add this method to any of your view controller unit test classes. Besides, it&#39;s a great way to verify that your view controllers get released correctly.</p><pre>/// Ensures that the OwnedBucketViewController gets deallocated after being added to the navigation stack, then popped.<br>func testDeallocation() {<br>    assertDeallocation { () -&gt; UIViewController in<br>        let bucket = Bucket()<br>        let viewModel = OwnedBucketViewModel(bucket: bucket)<br>        return OwnedBucketViewController(viewModel: viewModel)<br>    }<br>}</pre><p>The extension creates a weak reference to the view controller which is created in the closure. After that, we present and dismiss the created view controller after which we’re verifying that the weak reference is set to nil.</p><pre>extension XCTestCase {<br><br>    /// Verifies whether the given constructed UIViewController gets deallocated after being presented and dismissed.<br>    ///<br>    /// - Parameter testingViewController: The view controller constructor to use for creating the view controller.<br>    func assertDeallocation(of testedViewController: () -&gt; UIViewController) {<br>        weak var weakReferenceViewController: UIViewController?<br><br>        let autoreleasepoolExpectation = expectation(description: &quot;Autoreleasepool should drain&quot;)<br>        autoreleasepool {<br>            let rootViewController = UIViewController()<br><br>            // Make sure that the view is active and we can use it for presenting views.<br>            let window = UIWindow(frame: CGRect(x: 0, y: 0, width: 400, height: 400))<br>            window.rootViewController = rootViewController<br>            window.makeKeyAndVisible()<br><br>            /// Present and dismiss the view after which the view controller should be released.<br>            rootViewController.present(testedViewController(), animated: false, completion: {<br>                weakReferenceViewController = rootViewController.presentedViewController<br>                XCTAssertNotNil(weakReferenceViewController)<br><br>                rootViewController.dismiss(animated: false, completion: {<br>                    autoreleasepoolExpectation.fulfill()<br>                })<br>            })<br>        }<br>        wait(for: [autoreleasepoolExpectation], timeout: 10.0)<br>        wait(for: weakReferenceViewController == nil, timeout: 3.0, description: &quot;The view controller should be deallocated since no strong reference points to it.&quot;)<br>    }<br><br>    /// Checks for the callback to be the expected value within the given timeout.<br>    ///<br>    /// - Parameters:<br>    ///   - condition: The condition to check for.<br>    ///   - timeout: The timeout in which the callback should return true.<br>    ///   - description: A string to display in the test log for this expectation, to help diagnose failures.<br>    func wait(for condition: @autoclosure @escaping () -&gt; Bool, timeout: TimeInterval, description: String, file: StaticString = #file, line: UInt = #line) {<br>        let end = Date().addingTimeInterval(timeout)<br><br>        var value: Bool = false<br>        let closure: () -&gt; Void = {<br>            value = condition()<br>        }<br><br>        while !value &amp;&amp; 0 &lt; end.timeIntervalSinceNow {<br>            if RunLoop.current.run(mode: RunLoop.Mode.default, before: Date(timeIntervalSinceNow: 0.002)) {<br>                Thread.sleep(forTimeInterval: 0.002)<br>            }<br>            closure()<br>        }<br><br>        closure()<br><br>        XCTAssertTrue(value, &quot;➡️🚨 Timed out waiting for condition to be true: \&quot;\(description)\&quot;&quot;, file: file, line: line)<br>    }<br>}</pre><p>If any logic within the testing view controller retains the given view controller, this test would fail.</p><p>To validate that our weak reference is set to nil we&#39;re using another extension method on XCTestCase which is a very handy method to periodically check for a certain condition to match.</p><p>The XCTest API brings a great API for creating expectations for notifications, predicates or key-value observation, but none of these make it possible to validate that the weak reference is eventually set to nil. Our new extension method does make this possible. It checks for the given amount of time whether the condition is matched and if not, it fails.</p><h4>The use of an autoreleasepool</h4><p>Without the autoreleasepool we would’ve not been able to verify that the weak reference would eventually be released. All the references within the autoreleasepool closure should be released when it’s drained. This only happens if no strong references exist.</p><p>The above view controller example can be used to build more unit tests to verify the deallocation of your objects.</p><h4>More on memory debugging</h4><p>WWDC over the years dedicated quite a few sessions to memory debugging. For example, the <a href="https://developer.apple.com/videos/play/wwdc2018/416/">iOS Memory Deep Dive</a> session of WWDC 2018 which helps you understand the true memory cost of an image and gives you tips and tricks for reducing the memory footprint of an app.</p><p><em>Originally published at </em><a href="https://www.avanderlee.com/swift/memory-leaks-unit-tests/"><em>SwiftLee</em></a><em>.</em></p><p><em>More posts and updates: </em><a href="https://www.twitter.com/twannl"><em>@twannl</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccd6319979" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-programming/memory-leaks-prevention-using-an-autoreleasepool-in-unit-tests-ccd6319979">Memory leaks prevention using an autoreleasepool in unit tests</a> was originally published in <a href="https://medium.com/swift-programming">Swift Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[QR Code generation with a custom logo and color using Swift]]></title>
            <link>https://medium.com/swift-programming/qr-code-generation-with-a-custom-logo-and-color-using-swift-e1d0a44adbe3?source=rss----5396e0e8bc29---4</link>
            <guid isPermaLink="false">https://medium.com/p/e1d0a44adbe3</guid>
            <category><![CDATA[generator]]></category>
            <category><![CDATA[scanner]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[custom]]></category>
            <category><![CDATA[qr-code]]></category>
            <dc:creator><![CDATA[Antoine van der lee ]]></dc:creator>
            <pubDate>Tue, 08 Jan 2019 15:01:28 GMT</pubDate>
            <atom:updated>2019-01-08T15:01:28.401Z</atom:updated>
            <content:encoded><![CDATA[<p>A QR Code is used a lot to share content or to add a new user in apps like Twitter and Snapchat. Since iOS 11 it’s possible for users to scan a QR code with the built-in camera app. This makes it even nicer to integrate a QR code in your own app.</p><h4>Generating a QR code in iOS</h4><p>Generating a QR code in iOS is easier than ever since the introduction of the CIQRCodeGenerator Core Image filter. It generates a plain black and white QR for the given input string.</p><pre>guard let qrFilter = CIFilter(name: &quot;CIQRCodeGenerator&quot;) else { return nil }<br>let qrData = absoluteString.data(using: String.Encoding.ascii)<br>qrFilter.setValue(qrData, forKey: &quot;inputMessage&quot;)<br><br>let qrTransform = CGAffineTransform(scaleX: 12, y: 12)<br>let qrImage = qrFilter.outputImage?.transformed(by: qrTransform)</pre><p>This QR code works already, but it is not really appealing and it is probably not aligned with the awesome design of your own app. Therefore, it would be really nice if we could customize it to fit our app design.</p><h4>Changing the color of a QR code</h4><p>The first step in customizing the QR code is to change the color. We do this in three steps:</p><ul><li>Invert the colors black and white</li><li>Mask the black color to transparent</li><li>Change the color</li></ul><p>To make this code easier to use we create an extension on CIImage.</p><pre>extension CIImage {<br>    /// Inverts the colors and creates a transparent image by converting the mask to alpha.<br>    /// Input image should be black and white.<br>    var transparent: CIImage? {<br>        return inverted?.blackTransparent<br>    }<br><br>    /// Inverts the colors.<br>    var inverted: CIImage? {<br>        guard let invertedColorFilter = CIFilter(name: &quot;CIColorInvert&quot;) else { return nil }<br><br>        invertedColorFilter.setValue(self, forKey: &quot;inputImage&quot;)<br>        return invertedColorFilter.outputImage<br>    }<br><br>    /// Converts all black to transparent.<br>    var blackTransparent: CIImage? {<br>        guard let blackTransparentFilter = CIFilter(name: &quot;CIMaskToAlpha&quot;) else { return nil }<br>        blackTransparentFilter.setValue(self, forKey: &quot;inputImage&quot;)<br>        return blackTransparentFilter.outputImage<br>    }<br><br>    /// Applies the given color as a tint color.<br>    func tinted(using color: UIColor) -&gt; CIImage?<br>    {<br>        guard<br>            let transparentQRImage = transparent,<br>            let filter = CIFilter(name: &quot;CIMultiplyCompositing&quot;),<br>            let colorFilter = CIFilter(name: &quot;CIConstantColorGenerator&quot;) else { return nil }<br><br>        let ciColor = CIColor(color: color)<br>        colorFilter.setValue(ciColor, forKey: kCIInputColorKey)<br>        let colorImage = colorFilter.outputImage<br><br>        filter.setValue(colorImage, forKey: kCIInputImageKey)<br>        filter.setValue(transparentQRImage, forKey: kCIInputBackgroundImageKey)<br><br>        return filter.outputImage!<br>    }<br>}</pre><p>A QR code is often linking to a URL. Therefore, it’s nice to create an extension on URL as well.</p><pre>extension URL {<br><br>    /// Creates a QR code for the current URL in the given color.<br>    func qrImage(using color: UIColor) -&gt; CIImage? {<br>        return qrImage?.tinted(using: color)<br>    }<br><br>    /// Returns a black and white QR code for this URL.<br>    var qrImage: CIImage? {<br>        guard let qrFilter = CIFilter(name: &quot;CIQRCodeGenerator&quot;) else { return nil }<br>        let qrData = absoluteString.data(using: String.Encoding.ascii)<br>        qrFilter.setValue(qrData, forKey: &quot;inputMessage&quot;)<br><br>        let qrTransform = CGAffineTransform(scaleX: 12, y: 12)<br>        return qrFilter.outputImage?.transformed(by: qrTransform)<br>    }<br>}</pre><p>Which can be used as followed:</p><pre>let swiftLeeOrangeColor = UIColor(red:0.93, green:0.31, blue:0.23, alpha:1.00)<br>let qrURLImage = URL(string: &quot;https://www.avanderlee.com&quot;)?.qrImage(using: swiftLeeOrangeColor)</pre><figure><img alt="A QR code with a custom color" src="https://cdn-images-1.medium.com/max/740/0*lEBxsZ8guxrFjeYe.png" /><figcaption>A QR code with a custom color</figcaption></figure><h4>A QR code with a custom logo</h4><p>To make it a really outstanding QR we can add our own custom logo. As a QR code has a certain <a href="https://www.qrcode.com/en/about/error_correction.html">error correction</a> it allows us to replace a certain part of it with our custom logo. To do this, we create another extension on CIImage which takes our logo and returns a new CIImage which is a combination of the QR and our logo.</p><pre>extension CIImage {<br><br>    /// Combines the current image with the given image centered.<br>    func combined(with image: CIImage) -&gt; CIImage? {<br>        guard let combinedFilter = CIFilter(name: &quot;CISourceOverCompositing&quot;) else { return nil }<br>        let centerTransform = CGAffineTransform(translationX: extent.midX - (image.extent.size.width / 2), y: extent.midY - (image.extent.size.height / 2))<br>        combinedFilter.setValue(image.transformed(by: centerTransform), forKey: &quot;inputImage&quot;)<br>        combinedFilter.setValue(self, forKey: &quot;inputBackgroundImage&quot;)<br>        return combinedFilter.outputImage!<br>    }<br>}</pre><p>Combined with our updated URL extension we can create a nice new QR code including our own custom logo.</p><pre>extension URL {<br>        /// Creates a QR code for the current URL in the given color.<br>    func qrImage(using color: UIColor, logo: UIImage? = nil) -&gt; CIImage? {<br>        let tintedQRImage = qrImage?.tinted(using: color)<br><br>        guard let logo = logo?.cgImage else {<br>            return tintedQRImage<br>        }<br><br>        return tintedQRImage?.combined(with: CIImage(cgImage: logo))<br>    }<br>}<br><br>let swiftLeeOrangeColor = UIColor(red:0.93, green:0.31, blue:0.23, alpha:1.00)<br>let swiftLeeLogo = UIImage(named: &quot;swiftlee_qr_logo.png&quot;)!<br><br>let qrURLImage = URL(string: &quot;https://www.avanderlee.com&quot;)?.qrImage(using: swiftLeeOrangeColor, logo: swiftLeeLogo)</pre><figure><img alt="A QR Code generated in Swift using a custom color and logo" src="https://cdn-images-1.medium.com/max/740/0*shBxqLlmS3Idxiy8.png" /><figcaption>A QR Code generated in Swift using a custom color and logo</figcaption></figure><h4>A Playground to play around</h4><p>A complete version of this code can be found on Github <a href="https://github.com/AvdLee/QR-Code-Custom">here</a>. It’s a Playground to allow you to play around and create your own custom QR code.</p><p>If you want to read more about the QR code filter or any other Core Image filters, check out the <a href="https://developer.apple.com/library/archive/documentation/GraphicsImaging/Reference/CoreImageFilterReference/index.html#//apple_ref/doc/filter/ci/CIQRCodeGenerator">Apple Documentation</a>.</p><p><em>Originally published at </em><a href="https://www.avanderlee.com/swift/qr-code-generation-swift/"><em>SwiftLee</em></a><em>.</em></p><p><em>More posts and updates: </em><a href="https://www.twitter.com/twannl"><em>@twannl</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1d0a44adbe3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-programming/qr-code-generation-with-a-custom-logo-and-color-using-swift-e1d0a44adbe3">QR Code generation with a custom logo and color using Swift</a> was originally published in <a href="https://medium.com/swift-programming">Swift Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cheat sheet examples for Xcode and Swift development]]></title>
            <link>https://medium.com/swift-programming/cheat-sheet-examples-for-xcode-and-swift-development-c263b6328a67?source=rss----5396e0e8bc29---4</link>
            <guid isPermaLink="false">https://medium.com/p/c263b6328a67</guid>
            <category><![CDATA[assertionfailure]]></category>
            <category><![CDATA[preconditionfailure]]></category>
            <category><![CDATA[shortcuts]]></category>
            <category><![CDATA[fatal-error]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Antoine van der lee ]]></dc:creator>
            <pubDate>Tue, 08 Jan 2019 15:00:53 GMT</pubDate>
            <atom:updated>2019-01-08T15:00:53.645Z</atom:updated>
            <content:encoded><![CDATA[<p>A cheat sheet can be a handy tool to quickly reference Xcode, Swift or iOS logic from a compact overview. Ideally, you can print them out and lay them down on your desk. This makes it really easy to access and use them often. Therefore, I’ll show you a few useful cheat sheets which you can use during development.</p><h4>Assert, precondition or fatalError</h4><p><a href="https://twitter.com/krzyzanowskim">Marcin Krzyzanowski</a> created a great blog post called <a href="https://blog.krzyzanowskim.com/2015/03/09/swift-asserts-the-missing-manual/">Swift asserts — the missing manual</a> about the differences between assert, precondition, and fatalError. He explains each of them and what the impact is in terms of termination when using each in a production app without a debugger attached.</p><h4>The cheat sheet</h4><p>Make sure to check out the original version from Marcin in <a href="https://blog.krzyzanowskim.com/2015/03/09/swift-asserts-the-missing-manual/">his blog post</a>.</p><figure><img alt="Swift Assertions Cheat Sheet" src="https://cdn-images-1.medium.com/max/1024/0*QhfOoSLuGlx_YQD2.png" /><figcaption>Swift Assertions Cheat Sheet from Marcin Krzyzanowski</figcaption></figure><h4>Xcode Shortcuts</h4><p>A lot of Xcode cheat sheets exists. Some are just a big list of shortcuts like the one from <a href="https://www.shortcutfoo.com/app/dojos/xcode-mac/cheatsheet">ShortcutFoo</a> while others are more visual and useful to print out. Personally, I like to use the one from <a href="https://twitter.com/craiggrummitt">Craig Grummitt</a> which is very visual and covers most of the basic shortcuts in Xcode 10.</p><figure><img alt="Xcode Shortcuts" src="https://cdn-images-1.medium.com/max/1024/0*A_963TId6LIeELQ0.png" /><figcaption>The Xcode Shortcuts Cheat Sheet from Craig Grummitt</figcaption></figure><h4>GIT Cheat Sheet</h4><p>GIT is what we use on daily basis to manage version control and if you’re a terminal GIT user it can sometimes be hard to remember all commands. Therefore, it can be very handy to use the <a href="https://www.git-tower.com/blog/git-cheat-sheet/">GIT cheat sheet</a> provided by GIT tower. It’s especially handy for those commands you don’t often use. Besides, it’s also worth to mention their <a href="https://www.git-tower.com/blog/xcode-cheat-sheet/">Xcode cheat sheet</a>.</p><h4>More Xcode Shortcuts</h4><p>If you would like to read more about Xcode shortcuts, you can check out my blog post on <a href="https://www.avanderlee.com/workflow/essential-shortcuts-xcode-workflow/">Shortcuts essentials in Xcode to speed up your workflow</a>.</p><p><em>Originally published at </em><a href="https://www.avanderlee.com/workflow/cheat-sheet-xcode-swift/"><em>SwiftLee</em></a><em>.</em></p><p><em>More posts and updates: </em><a href="https://www.twitter.com/twannl"><em>@twannl</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c263b6328a67" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-programming/cheat-sheet-examples-for-xcode-and-swift-development-c263b6328a67">Cheat sheet examples for Xcode and Swift development</a> was originally published in <a href="https://medium.com/swift-programming">Swift Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create Xcode file templates and share them with your team]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swift-programming/create-xcode-file-templates-and-share-them-with-your-team-6a3af1b800f5?source=rss----5396e0e8bc29---4"><img src="https://cdn-images-1.medium.com/max/1280/1*OQOtTweu81vXXmzOIvY6wA.jpeg" width="1280"></a></p><p class="medium-feed-snippet">Define templates for creating types of files and allow all developers on the project to use them.</p><p class="medium-feed-link"><a href="https://medium.com/swift-programming/create-xcode-file-templates-and-share-them-with-your-team-6a3af1b800f5?source=rss----5396e0e8bc29---4">Continue reading on Swift Programming »</a></p></div>]]></description>
            <link>https://medium.com/swift-programming/create-xcode-file-templates-and-share-them-with-your-team-6a3af1b800f5?source=rss----5396e0e8bc29---4</link>
            <guid isPermaLink="false">https://medium.com/p/6a3af1b800f5</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[swift-programming]]></category>
            <dc:creator><![CDATA[Andrew Lord]]></dc:creator>
            <pubDate>Sun, 16 Dec 2018 01:58:12 GMT</pubDate>
            <atom:updated>2020-02-07T08:34:49.754Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Managing secrets within an iOS app]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swift-programming/managing-secrets-within-an-ios-app-e64ef54864f3?source=rss----5396e0e8bc29---4"><img src="https://cdn-images-1.medium.com/max/800/0*4UM7Sup1U9BTLlMR.png" width="800"></a></p><p class="medium-feed-snippet">Almost all iOS apps have API keys and other secrets, we shall look at how to access them securely from your code</p><p class="medium-feed-link"><a href="https://medium.com/swift-programming/managing-secrets-within-an-ios-app-e64ef54864f3?source=rss----5396e0e8bc29---4">Continue reading on Swift Programming »</a></p></div>]]></description>
            <link>https://medium.com/swift-programming/managing-secrets-within-an-ios-app-e64ef54864f3?source=rss----5396e0e8bc29---4</link>
            <guid isPermaLink="false">https://medium.com/p/e64ef54864f3</guid>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[cocoapods]]></category>
            <dc:creator><![CDATA[Andrew Lord]]></dc:creator>
            <pubDate>Sun, 16 Dec 2018 01:56:25 GMT</pubDate>
            <atom:updated>2020-02-07T09:49:56.923Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Simulator tools to get more out of the simulator]]></title>
            <link>https://medium.com/swift-programming/simulator-tools-to-get-more-out-of-the-simulator-fa6f3132f2b8?source=rss----5396e0e8bc29---4</link>
            <guid isPermaLink="false">https://medium.com/p/fa6f3132f2b8</guid>
            <category><![CDATA[simulator]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[simmagnifier]]></category>
            <category><![CDATA[simpholders]]></category>
            <category><![CDATA[core-data-browser]]></category>
            <dc:creator><![CDATA[Antoine van der lee ]]></dc:creator>
            <pubDate>Wed, 12 Dec 2018 09:36:58 GMT</pubDate>
            <atom:updated>2018-12-12T09:36:58.535Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Especially the rulers can help you stop using the Mac screenshot pixel feedback to measure distance in your UI.</blockquote><p>Simulator tools give you access to more functionalities within the iOS simulator and make it often easier to access features like <a href="https://www.avanderlee.com/workflow/capture-ios-simulator-video-app-preview/">recording a video with xcrun</a>.</p><p>Some of the tools are paid while others are open sourced and free.</p><h3>Antoine v.d. Lee 🇳🇱 on Twitter</h3><p>I&#39;m looking for a list of Mac apps to interact with the Xcode simulators, like https://t.co/V22L4e4BIk Anyone using a similar tool? #ios #xcode #swift</p><h3>SimPholders</h3><p><strong>Website:</strong> <a href="https://simpholders.com/">simpholders.com</a><br><strong>Price:</strong> €9.90</p><p>Although this app seems outdated, it does still work on Mojave. Feature highlights include quick access to the user defaults and the App Groups Container, but nothing really big to make it an outstanding added value. With <a href="https://github.com/dsmelov/simsim">open-source alternatives</a>, you might want to save yourself the money.</p><figure><img alt="The SimPholders application window opened" src="https://cdn-images-1.medium.com/max/1024/0*gE2y747EV0bbdu_B.png" /><figcaption>The SimPholders application window opened.</figcaption></figure><h3>simMagnifier</h3><blockquote>Easily access apps on your iOS Simulators. Explore folders, edit Core Data content and much more!</blockquote><p><strong>Website:</strong> <a href="http://microedition.biz/simMagnifier/">microedition.biz/simMagnifier</a><br><strong>Price:</strong> $18.00</p><p>simMagnifier comes with a bit more features compared to SimPholders, but is a bit more expensive as well. This might be the tool for you if you’re using Core Data as it comes with a Core Data browser with even the possibility to change data. Access to common folders and the user defaults are included as well.</p><figure><img alt="simMagnifier is one of the simulator tools with a Core Data browser." src="https://cdn-images-1.medium.com/max/1024/0*PA4A3NwAWku_UEqg.png" /><figcaption>simMagnifier window opened with Core Data access.</figcaption></figure><h3>xScope 4.0</h3><blockquote>Measure. Inspect. Test.</blockquote><p><strong>Website:</strong> <a href="https://xscopeapp.com/">xscopeapp.com</a><br> <strong>Price:</strong> $49.99</p><p>Although xScope is the most expensive one from this simulator tools list, it comes with the most features as well. It could easily be listed with the <a href="https://www.avanderlee.com/debugging/ui-debugging-by-making-use-of-third-party-apps/">UI Tools blog post</a> from a few weeks ago. It’s not a tool to access Core Data or User Defaults and it does not provide quick access to common folders, but it does add a lot of tools to verify your UI. These tools include rulers, guides and a loupe which follows your mouse for a more detailed view of a piece of UI. Especially the rules can help you stop using the Mac screenshot pixel feedback to measure distance in your UI.</p><figure><img alt="The Loupe enabled in xScope to measure distance in the UI" src="https://cdn-images-1.medium.com/max/665/0*X8iB1-CpjAz35M-O.png" /><figcaption>The Loupe enabled in xScope to measure distance in the UI.</figcaption></figure><h3>Unmentioned Open Source alternatives</h3><p>Apart from these paid tools, some open source alternatives are available to use as well and worth to explore.</p><ul><li><a href="https://github.com/wix/AppleSimulatorUtils">AppleSimulatorUtils</a></li><li><a href="https://github.com/dsmelov/simsim">SimSim</a></li></ul><p><em>Originally published at </em><a href="https://www.avanderlee.com/debugging/simulator-tools/"><em>SwiftLee</em></a><em>.</em></p><p><em>More posts and updates: </em><a href="https://www.twitter.com/twannl"><em>@twannl</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa6f3132f2b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-programming/simulator-tools-to-get-more-out-of-the-simulator-fa6f3132f2b8">Simulator tools to get more out of the simulator</a> was originally published in <a href="https://medium.com/swift-programming">Swift Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>