<?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 Humi on Medium]]></title>
        <description><![CDATA[Stories by Humi on Medium]]></description>
        <link>https://medium.com/@bastihumann?source=rss-d7ab83826ff7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*XElLVhJj0-U5RlBYVpiOQQ.jpeg</url>
            <title>Stories by Humi on Medium</title>
            <link>https://medium.com/@bastihumann?source=rss-d7ab83826ff7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:59:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bastihumann/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[Swift — Proactive Memory-Leak protection]]></title>
            <link>https://medium.com/@bastihumann/swift-proactive-memory-leak-protection-7155aa90ed0?source=rss-d7ab83826ff7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7155aa90ed0</guid>
            <category><![CDATA[memory-leak]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Humi]]></dc:creator>
            <pubDate>Fri, 24 Jul 2020 09:40:58 GMT</pubDate>
            <atom:updated>2020-07-24T09:40:58.905Z</atom:updated>
            <content:encoded><![CDATA[<h3>Swift — Proactive Memory-Leak protection</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3I25BxGM_1-2B9Uw87pt1A.jpeg" /><figcaption>Thank you for that great image <a href="https://unsplash.com/@daanmooij">https://unsplash.com/@daanmooij</a></figcaption></figure><p>If you ever developed a medium-size App using MVVM you probably ran into some memory leaks. Missing the [weak self] keyword in your escaping subscriber closure is from my experience the root cause for most memory leaks. But finding those wrong strong capturing of strong self could be a mess. Wouldnt it be nice to have an active Leak-Protector that runs parallel to your App and watches and alerts you on detection.</p><p>I found out that the most and worst memory leaks are happening to finds place in your ViewController. The core idea is, that you actively register relevant classes to the LeakProtector and deregister on deinit. On the second registration, the Protector throws an fatalError and warns you about your possible memory leak, so you can recheck that ViewController.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/70f97afaeb8a991a1d591fd73afa8c86/href">https://medium.com/media/70f97afaeb8a991a1d591fd73afa8c86/href</a></iframe><p>If you forget to write weak you can also forget to correctly register and deregister from LeakProtector. So I found it handy to move the leak protection code into a base class for UIViewController. All your ViewControllers should then extend the ViewController class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3568af0e2c736ba365e781bb7bcb272/href">https://medium.com/media/f3568af0e2c736ba365e781bb7bcb272/href</a></iframe><p>Please keep in mind that this code is only tooling that can help you find the leaking references.</p><p>See also: <a href="https://medium.com/better-programming/diagnose-memory-leaks-using-xcode-instruments-5692a6458020">Diagnose Memory Leaks Using Xcode Instruments</a></p><p>Feel free to ask questions or leave comments I will add an example project later this week.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7155aa90ed0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ready for Swift Package Manger?]]></title>
            <link>https://medium.com/@bastihumann/ready-for-swift-package-manger-3defcca50ca3?source=rss-d7ab83826ff7------2</link>
            <guid isPermaLink="false">https://medium.com/p/3defcca50ca3</guid>
            <category><![CDATA[ios-13]]></category>
            <category><![CDATA[xcode11]]></category>
            <category><![CDATA[swift-package-manager]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[cocoapods]]></category>
            <dc:creator><![CDATA[Humi]]></dc:creator>
            <pubDate>Mon, 09 Sep 2019 20:53:41 GMT</pubDate>
            <atom:updated>2019-09-16T14:04:49.081Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ready for Swift Package Manager?</h3><p>This script helps you to find out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*J5rTVqhhem2A-IaSP72jlA.png" /></figure><p>This year Swift Package Manager has made a huge step forward. Integrated into <a href="https://developer.apple.com/wwdc19/408">Xcode 11</a> it is no longer a Package Manager that you should ignore. While some of the Open Source Projects you are using have problems adopting to Swift Package Manager, because of (at the moment) missing features like <a href="https://forums.swift.org/t/swift-pm-bundles-and-resources/13981">Resource handling</a>, others are already fully supported. But how to figure out which Libraries are ready to migrate?</p><p>I wrote a small script that does the whole work for you if you are using Cocoapods.</p><h3>4 simple steps:</h3><h4>1. In Terminal go to your project root folder</h4><pre>cd {project-root}</pre><h4>2. Download latest script version</h4><pre>curl https://raw.githubusercontent.com/StatusQuo/spmready/master/main.swift -o spmready.swift</pre><h4>3. Make it executable</h4><pre>chmod +x spmready.swift</pre><h4>4. Run</h4><pre>./spmready.swift</pre><p>Hope this helps 😊</p><h3>Where do we go from here?</h3><p>Do I really need all my dependencies ready before I consider a migration? No, you can start migration today.</p><h4>Mixed Migration aka Early Adopter</h4><p>Imagine you have your cocoapods and SwiftPackages imported by Swift Package Manager at the same time. This is a good idea and works pretty well as long as the pods don’t depend on a SwiftPackage and vice versa. You also have to make some other considerations. If you are using Swift Package Manager now, you will be part of the early adopters that are switching early. This doesn’t mean that Swift Package Manager is unstable at all but it needs help from us — the community. To follow its evolution, have a look at the <a href="https://forums.swift.org/c/development/SwiftPM">swift forums</a>. Nevertheless, adding the Libraries Acknowledgments gets a little bit harder. While cocoapods merges all Acknowledgments into a single file for you, Swift Package Manager doesn’t even care about you being a (bad) Copycat. Moreover, it can be possible that some libraries never will be supported by the Swift Package Manager because of its lacking community. Then maybe its time to drop this Library and replace it with one that has similar functionality. That way you put yourself in response to clean up and update your dependencies.</p><h4>Sit and wait</h4><blockquote>Hey Siri remind me to check spmready for migration in one year</blockquote><p>This is fine. Working with two Dependency Managers can be exhausting and no one can tell you how long it will take until all libraries you are using have SwiftPM support. But please consider contributing to the open-source project, you can always file an issue on Github to show that you care.</p><h4>Old is gold</h4><blockquote>I have cocoa pods/Carthage. So why do I need another Swift Package Manager?!</blockquote><p>I think SwiftPM will be the new standard dependency manager. It feels just right to have dependencies managed and viewable in your IDE. And if you really don’t ever think about migrating to the new, you probably wouldn’t click a headline like this 🤷‍♀️.</p><p><a href="https://github.com/StatusQuo/spmready">StatusQuo/spmready</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3defcca50ca3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to backup Firestore the Firebase way]]></title>
            <link>https://medium.com/@bastihumann/how-to-backup-firestore-the-firebase-way-874da6d75082?source=rss-d7ab83826ff7------2</link>
            <guid isPermaLink="false">https://medium.com/p/874da6d75082</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[firestore]]></category>
            <category><![CDATA[cloud-scheduler]]></category>
            <category><![CDATA[backup]]></category>
            <category><![CDATA[cloud-functions]]></category>
            <dc:creator><![CDATA[Humi]]></dc:creator>
            <pubDate>Fri, 12 Jul 2019 10:17:22 GMT</pubDate>
            <atom:updated>2019-07-12T10:18:57.769Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using Cloud Scheduler and Cloud Functions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*qMV-yjn0tVuB3clXxAlB_g.png" /></figure><h4>Status quo (07/2019)</h4><p>it is not possible to automate backups of firestore database in firebase console like it is for the realtime database. <strong>You have to do it on your own!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*WzDBZ7Td9OPN1Rxnvvcnug.png" /></figure><p>And No. No backup is no option :)</p><p>Google advises you this to use cronjob + AppEngine + bucket: <a href="https://firebase.google.com/docs/firestore/solutions/schedule-export">https://firebase.google.com/docs/firestore/solutions/schedule-export</a></p><p>What&#39;s wrong with this idea? Nothing at all but I think we have a better option since we can use Cloud Scheduler (introduced in 2018). We will build a scheduled cloud function that does the job!</p><h4>Let&#39;s start:</h4><h4>Step 1 — Create a Service Account:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*kUGdDQDN5Z6tE9uwciLjOg.png" /></figure><ol><li>Goto <a href="https://console.cloud.google.com/iam-admin/serviceaccounts">https://console.cloud.google.com/iam-admin/serviceaccounts</a></li><li>Click <strong>CREATE SERVICE ACCOUNT</strong></li><li>Type a name (eg. firestore-backup)and description</li><li>Select Role Cloud Datastore Import Export Admin</li><li>In the last Step, click <strong>CREATE KEY </strong>and save it as JSON</li></ol><h4>Step 2 — Create a new Bucket for Backups</h4><p>After that, we create have to create a new bucket for our backups</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*sCugSdp-1uJ3wgW87tc9zA.png" /></figure><ol><li>Goto <a href="https://console.cloud.google.com/storage/browser">https://console.cloud.google.com/storage/browser</a></li><li>Click <strong>CREATE BUCKET</strong></li><li>Name: YOUR_PROJECT_ID-firestore-backup</li><li>Select Storage Class, Location, ACM and Encryption</li></ol><blockquote>Suggestions<br>Multiregional Class, Same Location as your Firesbase Project,<br>Object Level ACM, Google Managed Encryption</blockquote><h4>Step 3 — Add Permission to Service Account</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*z2Vo1zHfo5KIIAEmdrv85g.png" /></figure><ol><li>Open your Bucket and go to <strong>Permissions.</strong></li><li>Click <strong>Add Members</strong></li><li>Type in the Name of your new service account (eg. firestore-backup@...<em>)</em></li><li>Select the role: Storage Admin</li></ol><blockquote>If you like you can add a lifecycle to your bucket to delete backups older then 30 days.</blockquote><h4>Step 4 — Add Scheduled Cloud Function to run Backup</h4><p>Now use your service account key JSON and jump to your cloud functions. The example is written in typescript.</p><p>In your tsconfig.json add under compilerOptions</p><pre>&quot;resolveJsonModule&quot;: true </pre><p>Install googleapis :</p><pre>npm install -s googleapis</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/360a5971ba614fdbaf79698646fe51ae/href">https://medium.com/media/360a5971ba614fdbaf79698646fe51ae/href</a></iframe><p>What this code does:</p><ul><li>Create a scheduled job that triggers every day at 12 pm (00:00)</li><li>That job triggers the cloud function you see here</li><li>In the function, we call the export documents API method of googleapis</li><li>This API method does all the work in background and will return within 1 sec</li></ul><p>Now deploy your function to firebase and you will see in firebase console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*3xHd6aqT_nbG63SWNhzM4Q.png" /></figure><h4>Bonus Tipp:</h4><blockquote>Big change? Trigger extra backup? Just go to your cloud scheduler tab and click run. Here you go with your extra backup.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*N7Lxf0-rpxOxKxoICduwHQ.png" /><figcaption><a href="https://console.cloud.google.com/cloudscheduler">https://console.cloud.google.com/cloudscheduler</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=874da6d75082" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>