<?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 Wendy Liga on Medium]]></title>
        <description><![CDATA[Stories by Wendy Liga on Medium]]></description>
        <link>https://medium.com/@wendyliga?source=rss-9e3511fbad3d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*WDe6sA8UZqSdCyoAcijlZA.jpeg</url>
            <title>Stories by Wendy Liga on Medium</title>
            <link>https://medium.com/@wendyliga?source=rss-9e3511fbad3d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:20:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wendyliga/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[How to Turn On TPM on MSI B550 Tomahawk]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://wendyliga.medium.com/how-to-turn-on-tpm-on-msi-b550-tomahawk-fe8a8e6b7db4?source=rss-9e3511fbad3d------2"><img src="https://cdn-images-1.medium.com/max/1024/1*8OuLyq8YpH1RadwcX5aqBQ.jpeg" width="1024"></a></p><p class="medium-feed-snippet">Trusted Platform Module is required for the next Windows 11</p><p class="medium-feed-link"><a href="https://wendyliga.medium.com/how-to-turn-on-tpm-on-msi-b550-tomahawk-fe8a8e6b7db4?source=rss-9e3511fbad3d------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://wendyliga.medium.com/how-to-turn-on-tpm-on-msi-b550-tomahawk-fe8a8e6b7db4?source=rss-9e3511fbad3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe8a8e6b7db4</guid>
            <category><![CDATA[windows-11]]></category>
            <category><![CDATA[pc]]></category>
            <category><![CDATA[tpm]]></category>
            <category><![CDATA[bio]]></category>
            <category><![CDATA[updates]]></category>
            <dc:creator><![CDATA[Wendy Liga]]></dc:creator>
            <pubDate>Thu, 08 Jul 2021 16:17:05 GMT</pubDate>
            <atom:updated>2021-07-08T16:17:05.169Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Add Compiled Frameworks in Swift Package Manager]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/better-programming/how-to-add-compiled-frameworks-in-swift-package-manager-f0cdbde84fc7?source=rss-9e3511fbad3d------2"><img src="https://cdn-images-1.medium.com/max/2600/1*TgepyIhQRpwI2zcsFUQi4A.jpeg" width="4288"></a></p><p class="medium-feed-snippet">Swift 5.3 brings binary dependency or compiled frameworks to SPM</p><p class="medium-feed-link"><a href="https://medium.com/better-programming/how-to-add-compiled-frameworks-in-swift-package-manager-f0cdbde84fc7?source=rss-9e3511fbad3d------2">Continue reading on Better Programming »</a></p></div>]]></description>
            <link>https://medium.com/better-programming/how-to-add-compiled-frameworks-in-swift-package-manager-f0cdbde84fc7?source=rss-9e3511fbad3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0cdbde84fc7</guid>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Wendy Liga]]></dc:creator>
            <pubDate>Wed, 03 Jun 2020 16:42:30 GMT</pubDate>
            <atom:updated>2020-06-03T16:42:30.339Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Add Resources in Swift Package Manager]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/better-programming/how-to-add-resources-in-swift-package-manager-c437d44ec593?source=rss-9e3511fbad3d------2"><img src="https://cdn-images-1.medium.com/max/2400/1*sDaMJzyqW1MaPf474-2c3g.jpeg" width="2400"></a></p><p class="medium-feed-snippet">Swift 5.3 brings resource capabilities to SPM</p><p class="medium-feed-link"><a href="https://medium.com/better-programming/how-to-add-resources-in-swift-package-manager-c437d44ec593?source=rss-9e3511fbad3d------2">Continue reading on Better Programming »</a></p></div>]]></description>
            <link>https://medium.com/better-programming/how-to-add-resources-in-swift-package-manager-c437d44ec593?source=rss-9e3511fbad3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c437d44ec593</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[spm]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Wendy Liga]]></dc:creator>
            <pubDate>Fri, 22 May 2020 12:18:01 GMT</pubDate>
            <atom:updated>2020-06-24T11:51:43.042Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Create GIFs Using Your Xcode Simulator With Mimiq]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/better-programming/create-gifs-using-your-xcode-simulator-with-mimiq-581607a6a776?source=rss-9e3511fbad3d------2"><img src="https://cdn-images-1.medium.com/max/2600/1*JnhhCnQNW0Usj5EhjOMNsQ.png" width="3360"></a></p><p class="medium-feed-snippet">An easy, open-source way to share Simulator GIFs with your team</p><p class="medium-feed-link"><a href="https://medium.com/better-programming/create-gifs-using-your-xcode-simulator-with-mimiq-581607a6a776?source=rss-9e3511fbad3d------2">Continue reading on Better Programming »</a></p></div>]]></description>
            <link>https://medium.com/better-programming/create-gifs-using-your-xcode-simulator-with-mimiq-581607a6a776?source=rss-9e3511fbad3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/581607a6a776</guid>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Wendy Liga]]></dc:creator>
            <pubDate>Mon, 18 May 2020 10:55:01 GMT</pubDate>
            <atom:updated>2020-05-18T10:55:01.725Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Write Efficient Code with Closure]]></title>
            <link>https://wendyliga.medium.com/write-efficient-code-with-closure-e5175e747f54?source=rss-9e3511fbad3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5175e747f54</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[swif]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[closure]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Wendy Liga]]></dc:creator>
            <pubDate>Mon, 02 Mar 2020 02:35:03 GMT</pubDate>
            <atom:updated>2020-06-18T12:55:45.992Z</atom:updated>
            <content:encoded><![CDATA[<h3>Write an Efficient Code with Closure</h3><h4>Explore a new way to write your code with Closure to write better efficient code</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R4aU-0aUtoWRS_JaRKV6jg.png" /></figure><p>It’s no secret that the iPhone user is expecting high-quality apps they used on their iPhone. Especially since Apple has set a high bar in terms of the quality of apps on the iPhone. They create their hardware and software, and this is the recipe for success. They can write very efficient software because they know what and how this hardware behaves. That being said, as an iOS Software Engineer, it is our “nature’s call” to write great apps that run smoothly, and “Just Work” on iPhone.</p><p>One Big aspect of great apps on the iPhone is code that runs efficiently. So what and how code can classify as an efficient code? There’s no specific definition of it, but most of the time, this code can be identified by several things like no redundant process or unnecessary code, optimal memory management, optimizing access of data, etc. There’s a lot of it. And still, until this date, people even debate and find ways to improve code to better efficiency.</p><p>And now I want to describe several ways how you can utilize closure to improve your code efficiency</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eoD9cIBAcKh_11nazK91_Q.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@clyde_he?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Clyde He</a> on <a href="https://unsplash.com/s/photos/light?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Function inside Function</h3><p>When you write a function, and maybe you find your self write repetitive code inside a function, you can utilize</p><pre>func animate() {<br>   let animation: () -&gt; Void = {<br>      UIView.animate(withDuration: 0.3, animations: {<br>         // animation here<br>      })<br>   }</pre><pre>   if Thread.isMainThread {<br>      animation()<br>   } else {<br>      DispatchQueue.main.async(execute: animation)<br>   }<br>}</pre><p>In this case, I want to make sure my animation code runs on the main thread. So instead of repeating, I will create a closure that acts as a function.</p><h3>Place the Right Code in the Right Time</h3><p>Imagine closure as a way to pass a block of code without executing it, and then you can utilize it to run later for the right time.</p><pre>func filter(<br>   _ data: [String], <br>   onRecoverFromError recoverData: () -&gt; [String]) -&gt; [String]<br>) {<br>   // 1<br>   if error {<br>      return recoverData()<br>   }<br>   <br>   // ...<br>   // ...<br>   // ...<br>}</pre><pre>// 2<br>var recoverData: () -&gt; [String] {<br>   return { data in<br>      // you need to do expensive task<br>   }<br>}</pre><pre>filter(users, onRecoverFromError: recoverData)</pre><p>In this example, this function filter(data: onRecoverFromError:) asks the callers to provide some fallback data. This fallback data will return every item that meets specific rules. The fallback data will only be called when the operation ends in error. So then it does not make sense to calculate this fallback data when it’s not being used. So closure coming handy here.</p><p>The closure will defer the execution of its block. The block code inside closure will not be executed if no code was running it. This behavior is convenient to help reduce expensive tasks in a case like this.</p><p>Let’s imagine you have a very expensive task that will be used on some condition, instead of calculating it, spend resources to handle it, why not defer its execution until the right condition instead.</p><p>For real example you can look apple’s log api for swift implementation</p><p><a href="https://github.com/apple/swift-log/blob/c08d7f72b93a425ff610b54f428995a2fde39cb7/Sources/Logging/Logging.swift#L60">apple/swift-log</a></p><pre>@inlinable    <br>public func log(level: Logger.Level, _ message: @autoclosure () -&gt; Logger.Message, metadata: @autoclosure () -&gt; Logger.Metadata? = nil,                    file: String = #file, function: String = #function, line: UInt = #line)</pre><p>Which using closure for passing message and metadata params at its function. This implementation choosen because of performance reason described above.</p><h3>Wrap Up</h3><p>There are lots of ways to improve efficiency on your code, from reducing unnecessary processes, removing repetitive code, or how to use memory efficiently. And closure can provide several ways to do it.</p><p>In the end, efficient code will always be a debate topic, and the way we improve our code gradually is how we can truly achieve that. Try to think about the impact on the code you write, how this will affect performance, how to place code at the right time, and things will go the way you want.</p><p>Thanks for your attention. Maybe you can check my other article about <a href="https://byrslf.co/model-is-more-than-just-data-structure-b5d95cfe505b?source=your_stories_page---------------------------">Model is more than Data Structure</a>. Until then, I hope to see you in my next article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5175e747f54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Model is more than just Data Structure]]></title>
            <link>https://medium.com/life-tips/model-is-more-than-just-data-structure-b5d95cfe505b?source=rss-9e3511fbad3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5d95cfe505b</guid>
            <category><![CDATA[beyourself]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[model]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Wendy Liga]]></dc:creator>
            <pubDate>Mon, 27 Jan 2020 12:54:21 GMT</pubDate>
            <atom:updated>2020-02-13T15:40:15.282Z</atom:updated>
            <content:encoded><![CDATA[<h3>Things Model can do more for you</h3><figure><img alt="A Raging Gorilla Face" src="https://cdn-images-1.medium.com/max/1024/1*n8A_SUt4K8DxkXD4i01dKQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ahmetsali?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ahmet Sali</a> on <a href="https://unsplash.com/s/photos/fake?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Model is a crucial part of our daily life as a Software Engineer. We use model to represent a state or data on our works. But you know what ? there are several powerful ways to utilize the model to maximize its potential.</p><h3>Representing a State</h3><p>We can create a Model that representing some state on our code. This Paradigm is heavily used on SwiftUI. Think Model as the only source for how your code reacts to things. Let’s say you have a Setting page, and all of it’s rendered value or anything that can the behave on screen will be determined by the model specifically designed for this page.</p><p>This model will contain what it takes to display any information on this page (like the text value, font size, text color, and etc.), and every single update to this value need to be handle to update its respective object. You will have the state that you can mutate to take effect.</p><p>By utilizing this paradigm, you will have very simple “Single Responsibility” concept on your code, because you know the only way to changes anything, is by updating its state.</p><p>More, you can utilize this concept to smaller part of your code, like home page, you can split things into smaller pieces like banner, what’s new view, or last visited view and then implementing this Model as a State, and then you can create a composition for it on the parent side and you will make a beautiful chaining updates that just works. It’s like magic</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*-FKkUiUL9BUj1WrGmEBdgw.jpeg" /><figcaption>It works like magic</figcaption></figure><h3>Model as a Function</h3><p>A lot of Code uses Model to represent the communication between code. Let’s say you have a Send Confirmation Page that will display your user data and ask to input their phone number, address, their choice of the delivery services. Then you will continue the confirmation to the next page or server.</p><pre>struct User {   <br>   let id: UUID<br>   let name: String<br>   let email: String<br>   let phoneNumber: String?<br>   let address: String?<br>   ...<br>}</pre><pre>struct DeliveryService {<br>   let id: UUID<br>   let name: String<br>   let price: Double<br>   ...<br>}</pre><p>then to continue to next page, for example you need create a “UserDeliveryConfirmation” that will contain User id, phoneNumber and address and DeliveryService id and price. it will easly done by create a function or just code like</p><pre>func sendUserConfirmation(user: User, deliveryService: DeliveryService, completion: @escaping (UserDeliveryConfirmation) -&gt; Result) {</pre><pre>//1<br>guard let phoneNumber = user.phoneNumber, let address = user.address else {<br>   completion(.error)<br>}</pre><pre>guard let deliveryId = deliveryService.id, let deliveryPrice = deliveryService.price else {<br>   completion(.error)<br>}</pre><pre>//2<br>let confirmation = UserDeliveryConfirmation(userId: User.id, phoneNumber: phoneNumber, address: address, deliveryId: deliveryId, deliveryPrice: deliveryPrice)</pre><pre>//3<br>Network.shared.request(confirmation, completion: completion)</pre><pre>}</pre><p>This example function is how most of the time its being handled. you parse the required model to function, check if all value is valid, then send request to network.</p><ol><li>validation value so all value should be valid.</li><li>init the model that will be send to network request.</li><li>request the network call.</li></ol><p>but what if we can use the model to done the job, let’s take a look</p><pre>struct UserDeliveryConfirmation {<br>   let userId: UUID<br>   let deliveryId: UUID<br>   let phoneNumber: String<br>   let address: String<br>   let deliveryPrice: Double</pre><pre>init(user: User, deliveryService: DeliveryService) throws {<br>  guard let phoneNumber = user.phoneNumber, let address = user.address else {<br>      throw Error.missingParameter<br>   }</pre><pre>  guard let deliveryId = deliveryService.id, let deliveryPrice = deliveryService.price else {<br>       throw Error.missingParameter<br>   }</pre><pre>   <br>   self.userId = User.id<br>   self.phoneNumber = phoneNumber<br>   self.address = address <br>   self.deliveryId = deliveryId <br>   self.deliveryPrice = deliveryPrice<br>}</pre><p>if you look closer, we move the validation of the value to init of the model, by this, we can let the model do the job, and we just know to parse the value and wait for the result</p><pre>func sendUserConfirmation(user: User, deliveryService: DeliveryService, completion: @escaping (UserDeliveryConfirmation) -&gt; Result) {</pre><pre>let confirmation = UserDeliveryConfirmation(userId: User.id, phoneNumber: phoneNumber, address: address, deliveryId: deliveryId, deliveryPrice: deliveryPrice)</pre><pre>Network.shared.request(confirmation, completion: completion)</pre><pre>}</pre><p>Now to create the model, you just parse the required model and it will do its job. you also can see if you can reuse the same validation on other place on your code, it’s beautiful.</p><p>but then, what’s the different between this and just create a function that will create the model ? i am affraid you don’t ask (litteraly i ask my self 😀).</p><p>If you create a function (init is function itself, but more like constructor that will always be there as language feature), you will get same result, same performance, same everything, but looks at bigger picture, if you use function, you need to make sure your peers or you in the future, know to locate the function, rather that, if you use model init, it will automatically be noticed by the reader that this model can be initiliaze by several case.</p><p>At other side, this approach is 100% testable means you can test this case on your unit test. more test more smile :).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*T5de3p1oPbKEL4yT8rvhBQ.jpeg" /><figcaption>Oh unit test</figcaption></figure><h3>Wrap Up</h3><p>As Software Engineer, we will surely use model on our works, utilizing model like making it as State, or separation concern is the key to maximizing the capabilities of model, increase readability, decreasing code complexity and all the goods stuff.</p><p>Thanks for read my simple story here, hope you enjoy and you can implementing good stuff on your code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5d95cfe505b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/life-tips/model-is-more-than-just-data-structure-b5d95cfe505b">Model is more than just Data Structure</a> was originally published in <a href="https://medium.com/life-tips">Be Yourself</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Say Goodbye to “ Index out of range” — Swift]]></title>
            <link>https://wendyliga.medium.com/say-goodbye-to-index-out-of-range-swift-eca7c4c7b6ca?source=rss-9e3511fbad3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/eca7c4c7b6ca</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Wendy Liga]]></dc:creator>
            <pubDate>Mon, 18 Nov 2019 03:27:08 GMT</pubDate>
            <atom:updated>2020-01-30T02:02:30.707Z</atom:updated>
            <content:encoded><![CDATA[<h3>Say Goodbye to “Index out of range” — Swift</h3><p>How to avoid fatal mistakes on array Swift.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_9-fYrzEZ5hT-uoqKhWUPg.png" /><figcaption>Thanks to <a href="https://undraw.co/">undraw.co</a> for a great illustration</figcaption></figure><p>As a Developer, Array is one of the crucial tools we use to build our code. Array create this possibility to save the collection of object that organizes by index, and it’s very powerful for code that handling looping or handling dynamic data.</p><p>One common error every array user ever faced is “Fatal error: Index out of range”.this error was caused by accessing an index that array doesn’t even have in the first place.</p><p>This error is undetectable on build time and can only show up on runtime which will be fatal on production or on distributed code. The solution here is to check whether the array is containing the index before accessing the index.</p><pre>let names = [&quot;Jhonson&quot;, &quot;Erica&quot;, &quot;Tom&quot;]</pre><pre>if names.indices.contains(0) {<br>   print(names[0])<br>}</pre><p>by checking if array contains that index or not before use it, we can make sure that we will not ever face “Index out of range” (if there’s no other thread/async code that changes the array value) because we can make sure that this array is containing index we want to access.</p><p>Under the hood, `indices.contain` will loop the entire array to check whether there’s the index that matches with array item. If you operate a big array, this solution will not really efficient. Thanks to the un-order type of array, we can always make sure that array will always have the upper index or lower index that represents the entire array item count.</p><pre>if index&gt;= names.startIndex &amp;&amp; index&lt; names.endIndex {<br>   print(names[index])<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*Bf1duWwWc1ZOEi3ICLvJfw.gif" /><figcaption>Wow</figcaption></figure><p>So rather than looping the entire array, we only need to check whether our desire index is inside the lower index or upper index range.</p><h3>Boilerplate Code</h3><blockquote>But what about if I want to access the index of array a lot, I will create a lot of boilerplate code :(</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*PwYKYgU0lft5VBSswQsc6g.gif" /><figcaption>Repeat Repeat Repeat</figcaption></figure><p>If you want to access a lot index of array a lot, you will start creating a lot of <a href="https://en.wikipedia.org/wiki/Boilerplate_code">boilerplate</a> code. Extension comes in handy and we can utilize its power</p><pre>extension Collection where Indices.Iterator.Element == Index {<br>   public subscript(safe index: Index) -&gt; Iterator.Element? {<br>     return (startIndex &lt;= index &amp;&amp; index &lt; endIndex) ? self[index] : nil<br>   }<br>}</pre><p>So we can use extension of Collection but only apply it on indices that use Index, in this case, array. we don’t want to apply this to other Collection like Set or Dictionary.</p><p>how to use</p><pre>print(names[safe: 0])</pre><p>It will return the value or if the array doesn’t contain the index, it will automatically return nil. is that neat?</p><h3>Update</h3><p>You can check my SwiftKit, my own personal swift helper that contain this array safe access, you can check it here</p><p><a href="https://github.com/wendyliga/SwiftKit">wendyliga/SwiftKit</a></p><h3>Wrap Up</h3><p>The array as one of the crucial tools for a lot of developers to write code is very powerful for handling dynamic data. but the caveat, we need to make sure we access the right index if we don’t want to face “Index out of range”. the key is to check whether the array contains index we want to access or not.</p><p>Thanks for your time on reading my medium post, Hope it can be helpful :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eca7c4c7b6ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Change Myself to Love to Read Books]]></title>
            <link>https://wendyliga.medium.com/how-i-change-myself-to-love-to-read-books-2d71fa9ed644?source=rss-9e3511fbad3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d71fa9ed644</guid>
            <category><![CDATA[mindfulness]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Wendy Liga]]></dc:creator>
            <pubDate>Fri, 11 Oct 2019 01:27:52 GMT</pubDate>
            <atom:updated>2019-10-13T07:45:10.954Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r3D1KwvoRzAAgN3rH0oKeA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ethanelisara?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ethan Elisara</a> on <a href="https://unsplash.com/s/photos/readinag-a-book?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>For a long time, I don’t read books. It feels so mundane, and I simply can’t do it. At a young age, like another student, I was forced to read books, so I can get a good grade and graduated.but outside that, I would never think to read books even just a little.</p><p>Growing up as a Software Engineer, I craft a behavior to read an article around technology, and this time it does not feel dull anymore. I willingly and passionately want to read it. I feel an urgency to know more and stay relevant as technology grows so fast. I acknowledge that the insurmountable information out there hence impossibility to know all of it. However, by start reading, I take a small piece compared to nothing.</p><p>As I am more comfortable and enjoy reading, I apprehend why people invest his/her time to read. There’re a lot of good things you got when you read. If I can fix something in my past, one of them is reading books. The past is history, and the future is what we should focus on. I want to redeem what I ought. I dare myself to read books daily.</p><h3>Start to Read</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*pIEdz9hbI83ZHOseqblZ1g.gif" /><figcaption>Courtesy of <a href="https://giphy.com/gifs/cartoons-comics-sea-reading-WoWm8YzFQJg5i">GIPHY</a></figcaption></figure><p>The secret to start reading books is to find a book that suits you. I am attracted to books around technology, self-help, and biography. By choosing books based on my interest, I got a reason to read that book. I want to read it to know what Elon Musk did to build Tesla, or how I can implement the latest technology on my work.</p><p>Throughout my journey on reading, I find a technique to increase concentration on the text and maintain understandable on the content. While reading, I use <strong><em>Speak </em></strong>feature on my iPad to sound out the word on the screen. By default, our mind will listen to the sound, and our reading will align with the sound.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1zwE_vDX06ZUeg2321DAOQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@danicanibano?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Daniel Cañibano</a> on <a href="https://unsplash.com/s/photos/ipad?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I prefer to read a digital book instead of a paper book. I am minimalist and prefer not having a lot of books mess up my room. Digital book has features like search the text, highlight sentences, or read the text on the device which paper book does not have.</p><h3>Benefit of Reading</h3><p>The first thing you will realize after reading the book is of course, the information you obtain from the book, and it will vary depending on the context of the book. I also learn that I don’t know a lot of things. I find a lot of exciting ways how to do things differently, how to perceive new ideas, or how to think from another point of view. I feel perseverant, calm, and more eager to learn something new. I got a more breadth point of view to a problem and the calculated approach to solve the problem.</p><h3>Finally</h3><p>So this is my story, how I change myself to love to read books. To sum up, I hope this story can inspire people out there to start to read books. I will continue to read my books, and you should read yours too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d71fa9ed644" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Layout on Texture]]></title>
            <link>https://wendyliga.medium.com/how-to-layout-on-texture-d037461f3f95?source=rss-9e3511fbad3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d037461f3f95</guid>
            <category><![CDATA[flexbox]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[asyncdisplaykit]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[texture]]></category>
            <dc:creator><![CDATA[Wendy Liga]]></dc:creator>
            <pubDate>Wed, 25 Sep 2019 12:27:35 GMT</pubDate>
            <atom:updated>2019-09-25T13:57:48.937Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KmFhOw-_21RfEh1166Es-w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@marvelous?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Marvin Meyer</a> on <a href="https://unsplash.com/s/photos/sketch?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><em>Note: This is a series about Texture, To fully understand this chapter, you can first read this chapter </em><a href="https://medium.com/@wendyliga/onboard-to-asynchronus-layout-api-texture-299b68d0ded9"><strong><em>Onboard to “Asynchronus” Layout API — Texture</em></strong></a><strong><em>.</em></strong></p><p>As you know, Texture is not using Auto Layout to layout its view. Texture using its own layout mechanism called LayoutSpec.</p><p>LayoutSpec is basically an API/Rules to manage how Node/View placement.</p><p>There are several LayoutSpec you can utilize to create your desired view.</p><h3>ASWrapperLayoutSpec</h3><p>ASWrapperLayoutSpec is a simple ASLayoutSpec subclass that can wrap a node and calculate the layout of the child based on the size set on the layout element.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39ec84db3b26194bf5cab7f53042acf9/href">https://medium.com/media/39ec84db3b26194bf5cab7f53042acf9/href</a></iframe><h3>ASStackLayoutSpec</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7da084f82f342339c66c6a69c9a1c6fa/href">https://medium.com/media/7da084f82f342339c66c6a69c9a1c6fa/href</a></iframe><p>Of all the layoutSpecs in Texture, ASStackLayoutSpec is the most useful and powerful. ASStackLayoutSpec uses the flexbox algorithm to determine the position and size of its children. Flexbox is designed to provide a consistent layout on different screen sizes. In a stack layout you align items in either a vertical or horizontal stack. A stack layout can be a child of another stack layout, which makes it possible to create almost any layout using a stack layout spec.</p><p>ASStackLayoutSpec has 7 properties in addition to its &lt;ASLayoutElement&gt; properties:</p><ul><li><strong>direction</strong>. Specifies the direction children are stacked in. If horizontalAlignment and verticalAlignment were set, they will be resolved again, causing justifyContent and alignItems to be updated accordingly.</li><li><strong>spacing</strong>. The amount of space between each child.</li><li><strong>horizontalAlignment</strong>. Specifies how children are aligned horizontally. Depends on the stack direction, setting the alignment causes either justifyContent or alignItems to be updated. The alignment will remain valid after future direction changes. Thus, it is preferred to those properties.</li><li><strong>verticalAlignment</strong>. Specifies how children are aligned vertically. Depends on the stack direction, setting the alignment causes either justifyContent or alignItems to be updated. The alignment will remain valid after future direction changes. Thus, it is preferred to those properties.</li><li><strong>justifyContent</strong>. It defines the alignment along the main axis.</li><li><strong>alignItems</strong>. Orientation of children along cross axis.</li><li><strong>flexWrap</strong>. Whether children are stacked into a single or multiple lines. Defaults to single line.</li><li><strong>alignContent</strong>. Orientation of lines along cross axis if there are multiple lines.</li></ul><p>With this configuration you can compose view based on CSS FlexBox.</p><h3><strong>ASInsetLayoutSpec</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c6fc952bfb0748612212e3e075784da/href">https://medium.com/media/4c6fc952bfb0748612212e3e075784da/href</a></iframe><p>You can use ASInsetLayoutSpec to set an Insets arround Node/View. Take a look at above example.</p><p>Hey, did you notice that we can chain LayoutSpec, Yes we can. The Beauty of LayoutSpec is you can create a complex composition from all LayoutSpec.</p><h3>ASOverlayLayoutSpec</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f521c44f3a594545ae1663190ad36d30/href">https://medium.com/media/f521c44f3a594545ae1663190ad36d30/href</a></iframe><p>If you want to create an overlay loading view on top on your view, you can utilize ASOverlayLayoutSpec. Just determine which is child and the other one as overlay, and you will get overlaying view.</p><h3><strong>ASBackgroundLayoutSpec</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/56ba4caf15ec0f1474d19fb6a1b94ac1/href">https://medium.com/media/56ba4caf15ec0f1474d19fb6a1b94ac1/href</a></iframe><p>LayoutSpec to set the base background of a LayoutSpec. It’s quite similar to ASOverlayLayoutSpec, and the main difference is background spec’s size is calculated from the child’s size. Thus, it is important that the child (blue layer) <strong>must</strong> have an intrinsic size or a size set on it.</p><h3><strong>ASCenterLayoutSpec</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80c3bb3dea0cb60b200046248bdf6fdd/href">https://medium.com/media/80c3bb3dea0cb60b200046248bdf6fdd/href</a></iframe><p>ASCenterLayoutSpec centers its child within its max constrainedSize.<br>If the center spec’s width or height is unconstrained, it shrinks to the size of the child.</p><p>ASCenterLayoutSpec has two properties:</p><ul><li>centeringOptions. Determines how the child is centered within the center spec. Options include: None, X, Y, XY.</li><li>sizingOptions. Determines how much space the center spec will take up. Options include: Default, minimum X, minimum Y, minimum XY.</li></ul><h3><strong>ASRatioLayoutSpec</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a9555a2e7279c63cec27e315d79a6f7/href">https://medium.com/media/9a9555a2e7279c63cec27e315d79a6f7/href</a></iframe><p>ASRatioLayoutSpec lays out a component at a fixed aspect ratio which can scale. This spec must have a width, or a height passed to it as a constrainedSize as it uses this value to scale itself.</p><h3><strong>ASRelativeLayoutSpec</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91fe5535ce274fd310ee9d19ae698df9/href">https://medium.com/media/91fe5535ce274fd310ee9d19ae698df9/href</a></iframe><p>Using Relative Layout, you can place view relatively to 9 positions based on 3x3, Horizontally start, center, end and Vertically start, center, end.</p><p>In the example above, you will put the view relatively to start at horizontal and start at vertical.</p><h3><strong>ASAbsoluteLayoutSpec</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af0415cb04f238bd171c309f40a96972/href">https://medium.com/media/af0415cb04f238bd171c309f40a96972/href</a></iframe><p>Absolute Layout Spec easily understandable when you imaging determine each view position manually, Texture support it too.</p><p>How we can implement it? Go to next series <a href="https://medium.com/@wendyliga/lets-get-our-hand-dirty-with-texture-4b0d3bcd0a5d"><strong><em>Let’s Get Our Hand Dirty with Texture</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d037461f3f95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Onboard to “Asynchronus” Layout API — Texture]]></title>
            <link>https://medium.com/tokopedia-engineering/onboard-to-asynchronus-layout-api-texture-299b68d0ded9?source=rss-9e3511fbad3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/299b68d0ded9</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[texure]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[asyndisplaykit]]></category>
            <dc:creator><![CDATA[Wendy Liga]]></dc:creator>
            <pubDate>Wed, 25 Sep 2019 11:31:32 GMT</pubDate>
            <atom:updated>2019-10-11T02:55:52.071Z</atom:updated>
            <content:encoded><![CDATA[<h3>Onboard to “Asynchronous” Layout API — Texture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DsW6_0ISHtKqjuyBiFSLrA.jpeg" /></figure><h3>What is Texture?</h3><p>Texture or previously known as AsyncDisplayKit is an abstraction layer of UIView which in turn is an abstraction over CALayer. Facebook initially developed Texture and then taken over by Pinterest. As UIView used Main Thread, Texture utilizes Background Thread to initialize and configure the node<strong><em>. </em></strong>Texture use Background Thread to do view calculation, image decoding, and text sizing.</p><h3>Node, what is that?</h3><p>Node is an abstraction layer over UIView, and if you know how to use UIKit’s UIView, you surely will quickly understand the node concept. Node shares almost all the attributes and functions with some additions.</p><p>You can find shared properties like <strong><em>backgroundColor</em></strong>, <strong><em>ClipToBounds</em></strong>, etc.</p><p>All view components of UIKit is built on top UIView, and All Texture component also has the same paradigm (build on top of ASDisplayNode).</p><p>Texture Components Equivalent to UIKit Components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mgcWSlOoqtM1DVLx44dW7Q.png" /><figcaption>ASLayoutElement Architecture from <a href="http://texturegroup.org/docs/node-overview.html">texturegroup.org</a></figcaption></figure><p>So several terms that maybe could help familiarize to Texture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wfAjLSrLYUSVJwOORGcSbg.jpeg" /><figcaption>Texture Components Equivalent to UIKit Components</figcaption></figure><h3>Node Containers</h3><p>ASDisplayNode is built based on UIView, and You can place Texture component on top UIKit. You can create your texture component and add it to your current existing View build on top UIKit.But, Texture provided what it called Node Containers, a container that can contain texture components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dtl8mNwuZIAUeuLfU7exfA.jpeg" /><figcaption>Texture Container Equivalent to UIKit Side</figcaption></figure><h3>Why we use Node Containers instead of UIKit Equivalent?</h3><blockquote>“ <em>A node container automatically manages the intelligent preloading of its nodes. This means that all of the Node’s layout measurement, data fetching, decoding, and rendering will be done asynchronously. Among other conveniences, this is why it is recommended to use nodes within a container node.</em> “, Texture Documentation</blockquote><p>That means using node container will take all the advantages Texture offer and prevent random blinking when you put Texture Component on UIKit. It’s recommended to use Node Container as its share almost all functions, properties, and behavior to UIKit equivalent.</p><h3>What it looks like ?</h3><p>Lets create simple Node Container</p><pre>class ViewController: ASViewController&lt;ASDisplayNode&gt; {   <br>   init() {    <br>      super.init(node: ASDisplayNode())     <br>      self.node.backgroundColor = .white  <br>   }   <br>   required init?(coder aDecoder: NSCoder) { <br>      fatalError(&quot;init(coder:) has not been implemented&quot;)  <br>   }<br>}</pre><p>As you can see it is really familiar with UIViewController.</p><h3>How do I Layouting Texture? Auto Layout? No, who needs that.</h3><p>Layouting on UIKit using Auto Layout sometimes can be a mess. We need to determine every constraint very precisely with other components and wind up getting a complicated and hard to maintain code.<br>Texture provides a straightforward yet sophisticated way to layout our nodes using a declarative way. Based on the CSS FlexBox model, we can easily create simple code and yet maintainable and readable. Let’s take a look below.</p><pre>node.layoutSpecBlock = {_,_ in     <br>    return ASWrapperLayoutSpec(layoutElement: self.titleNode)<br>}</pre><p>From the code above, LayoutSpec will determine how the layout will work on the node. ASWrapperLayoutSpec is one of many components to determine how layout in Texture will look like. This LayoutSpec will wrap the title node and add that to the node.</p><h3>Wrap Up</h3><p>The Texture is an Asynchronous Layout API that utilizes Background Thread to optimize and decrease Main Thread loads. Texture shares a lot of similarity to UIKit, so it will require less time to learn and understand Texture.</p><p>So What’s Next? Check out <a href="https://medium.com/@wendyliga/how-to-layout-on-texture-d037461f3f95"><strong><em>How to Layout on Texture</em></strong></a><strong><em> </em></strong><em>or</em><strong><em> </em></strong><a href="https://medium.com/@wendyliga/lets-get-our-hand-dirty-with-texture-4b0d3bcd0a5d"><strong><em>Let’s Get Our Hand Dirty with Texture</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=299b68d0ded9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tokopedia-engineering/onboard-to-asynchronus-layout-api-texture-299b68d0ded9">Onboard to “Asynchronus” Layout API — Texture</a> was originally published in <a href="https://medium.com/tokopedia-engineering">Tokopedia Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>