<?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 Marcio Klepacz on Medium]]></title>
        <description><![CDATA[Stories by Marcio Klepacz on Medium]]></description>
        <link>https://medium.com/@MarcioK?source=rss-c74bd287bdff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*R8BxXCF74JkeVdo1bx1Byw.png</url>
            <title>Stories by Marcio Klepacz on Medium</title>
            <link>https://medium.com/@MarcioK?source=rss-c74bd287bdff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 18:36:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@MarcioK/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[Predicting Bitcoin prices using linear regression and gradient descent.]]></title>
            <link>https://medium.com/coinmonks/predicting-bitcoin-prices-using-linear-regression-and-gradient-descent-b1ec122ed5ee?source=rss-c74bd287bdff------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1ec122ed5ee</guid>
            <category><![CDATA[gradient-descent]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[predictions]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Marcio Klepacz]]></dc:creator>
            <pubDate>Fri, 10 Aug 2018 16:36:51 GMT</pubDate>
            <atom:updated>2018-08-13T15:36:33.983Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*5Lt-aAsJDXg3cunlreamsQ.jpeg" /></figure><h4>On this article I’m going to show how gradient descent combined with linear regression works, using bitcoin prices and its number of searches on Google as data.</h4><p>Let’s assume there is a relationship between how many times bitcoin is searched on Google with its price, if we plot a graph where the x<em>-axis</em> is the the number of searches and <em>y </em>is the price, we can notice a linear pattern for when bitcoin gets more searches the price increases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*5Tczeg1ZkDqdTvlRr2EaNQ.png" /><figcaption>y-axis is the price in US$ and x is the number of searches.</figcaption></figure><blockquote><em>The point on this article is to show how gradient descent works. </em><strong><em>Not to have an accurate bitcoin price prediction.</em></strong></blockquote><p>We could draw a line that follows the linear pattern, but in order to have a accurate prediction the line has to be close from the data points.</p><h3>Drawing the line with the equation:</h3><pre>y = mx + b</pre><p>Where <em>m</em> is the line slope and <em>b</em> is where the line intercepts the y-axis. However how can we find optimal values for them? There is a technique called Gradient Descent that will help us find the optimal values.</p><h4>What is gradient descent</h4><p>Gradient descent is an optimization technique that helps decrease the error generated by an error function, here the error function is the<a href="https://www.wikiwand.com/en/Residual_sum_of_squares"> <strong>Sum of the Squared Errors</strong>.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/0*jCmg2-pnyTnRwxKU.JPG" /><figcaption>Imagine this line was drawn with guessed values for `m` and `b`. The error is the sum of the distance from the points to the line squared and divided by the number of points</figcaption></figure><h4>How can we decrease the error?</h4><p>We can blindly guess values for <em>m</em> and <em>b</em> and check if the error decreased, however this approach is not sane. <br>If we calculate the partial derivate we will know how fast the error value is moving, therefore we can update smartly the values. Think as a ball moving downhill, where the bottom is where we want to reach and the derivate will tell us how to update the value in order to get closer to the bottom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*MsjIMWTVdgqcbPJi.jpg" /><figcaption>In our case the x-axis is `m` or `b` <strong>not w</strong>.</figcaption></figure><h3>Finding `m` and `b` with Python and numpy.</h3><h4>What we are going to do:</h4><ol><li>Extract Bitcoin prices and number of Google searches.</li><li>Match the price with search date.</li><li>Set the hyper parameters: epoch, learning rate and initial values for <em>m</em> and <em>b</em>.</li><li>Calculate the error to check our algorithm learning.</li><li>Calculate the gradient: The derivate of <em>m</em> and the derivate of <em>b</em>.</li><li>Multiply by the learning rate and update with the difference from the current <em>m</em> and <em>b</em>.</li></ol><h4>Extract Bitcoin prices, number of Google searches and match the price with search date..</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95101fa2610f4b3bfe8d4a6ef4ccf159/href">https://medium.com/media/95101fa2610f4b3bfe8d4a6ef4ccf159/href</a></iframe><h4>Set the hyper parameters: epoch, learning rate and initial values for <em>m</em> and <em>b</em>.</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aab0e7c00503142cc2727c4987428c70/href">https://medium.com/media/aab0e7c00503142cc2727c4987428c70/href</a></iframe><h4>Calculate the error to check our algorithm learning.</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb0710d1278994f7c04067a0c493d1cf/href">https://medium.com/media/cb0710d1278994f7c04067a0c493d1cf/href</a></iframe><h4>Calculate the gradient: The partial derivative of <em>m</em> and the partial derivative of <em>b, then m</em>ultiply by the learning rate and update with the difference from the current <em>m</em> and <em>b</em>.</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3624fd716a73652ed4afd43adad0e178/href">https://medium.com/media/3624fd716a73652ed4afd43adad0e178/href</a></iframe><h3>Putting everything together</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4b06e5afe4726a967b3e5efeb48eddf/href">https://medium.com/media/e4b06e5afe4726a967b3e5efeb48eddf/href</a></iframe><h3>Drawing a line that best fits our data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*pIfAcho1Y7GviupbWG4nAA.png" /><figcaption>With optimal values of `m` and `b` we can draw a line that is closer to the points.</figcaption></figure><p>Thanks to gradient descent we were able to update the values in the direction we wanted and dropped the error rate resulting in a line that fits our data. You can <a href="https://github.com/marciok/bitcoin-prices-and-gradient-descent">find the complete notebook on github</a>.</p><h3>References:</h3><ul><li><a href="https://github.com/llSourcell/linear_regression_live">https://github.com/llSourcell/linear_regression_live</a></li><li><a href="https://www.wikiwand.com/en/Linear_regression">https://www.wikiwand.com/en/Linear_regression</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1ec122ed5ee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/predicting-bitcoin-prices-using-linear-regression-and-gradient-descent-b1ec122ed5ee">Predicting Bitcoin prices using linear regression and gradient descent.</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a token/coin on Ethereum]]></title>
            <link>https://medium.com/bitvest/how-to-create-a-token-coin-on-ethereum-e01c97b1dac0?source=rss-c74bd287bdff------2</link>
            <guid isPermaLink="false">https://medium.com/p/e01c97b1dac0</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Marcio Klepacz]]></dc:creator>
            <pubDate>Fri, 04 Aug 2017 20:34:19 GMT</pubDate>
            <atom:updated>2018-01-15T12:59:58.861Z</atom:updated>
            <content:encoded><![CDATA[<p>A couple of days ago I was trying to create a token for my Dapp (Decentralized App). However, I found the current tutorial on the <a href="https://www.ethereum.org/token">Ethereum website</a> not clear and missing references. My goal here is to show how to create a token on Ethereum using <a href="https://solidity.readthedocs.io/en/develop/">Solidity</a>, <a href="http://truffleframework.com/">Truffle</a> and <a href="https://github.com/MetaMask/metamask-extension">MetaMask</a> — <em>if you don’t know what these are, just click on them.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s2IDIJ026Ov3SwOu6PQA9Q.png" /><figcaption><a href="https://media.coindesk.com/uploads/2016/02/Screen-Shot-2016-02-24-at-10.42.13-AM-e1456328600212.png">https://media.coindesk.com/uploads/2016/02/Screen-Shot-2016-02-24-at-10.42.13-AM-e1456328600212.png</a></figcaption></figure><h3>The Token</h3><p>The name of our token will be Friendship, and represents how much another person is your friend.</p><p>Let’s start by creating a project with Truffle:</p><pre>$ mkdir Friendship # Project folder</pre><pre>$ cd Friendship # Accessing…</pre><pre>$ truffle init # Scaffolding the project</pre><p>If you check the generated contracts, you will see Metacoin.soland Convertlib.sol, just ignore, we’re not going to use them.</p><p>Create a new file called Friendship.sol under contracts folder. The token is a smart contract:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b118c547d3dae9dc01cf5306fbe2bad8/href">https://medium.com/media/b118c547d3dae9dc01cf5306fbe2bad8/href</a></iframe><p>Now, declare the properties that by <a href="https://github.com/ethereum/EIPs/issues/20">convention</a> represents tokens and create the initializer method that will have an initial supply as a parameter.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a030550b720080e3875220e7b2f2c67/href">https://medium.com/media/1a030550b720080e3875220e7b2f2c67/href</a></iframe><p>These properties will also make <a href="https://github.com/flyswatter/eth-token-tracker/blob/4ff3011f66f696cfa0370e2bd279f741f0fccb0a/lib/token.js#L73">MetaMask recognize</a> our contract as a token.</p><h3>Generating and Interacting</h3><p>In order to generate and manipulate the tokens, we need deploy the contract into the network, let’s use <a href="https://github.com/ethereumjs/testrpc">testrpc</a> to simulate an Ethereum client with two accounts previously created by MetaMask.</p><pre>$ testrpc --account=&quot;0xf3a..., 7000000000000000000&quot; --account=&quot;0xacb...,80000000000000000000000&quot; # Starting the client passing two private keys from two accounts generated by MetaMask and an amount of ether.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*g2OVVHC2S9XW1jT4_VVf6g.png" /><figcaption>The result</figcaption></figure><p>And require Friendship.sol into 2_deploy_contracts.js</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da323291e81b4bebe0de9af1941d362c/href">https://medium.com/media/da323291e81b4bebe0de9af1941d362c/href</a></iframe><h4>Migrate</h4><pre>truffle migrate --reset # Deploying the contract into the network</pre><p>After migrating, you can see that <strong>Bar </strong>has all the tokens, because truffle will grab the first account and make it the default — <em>the first private key passed to testrpc is from Bar.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*_2JPSnOJ_UOzs2JaNTemKA.png" /></figure><h4>Interacting / Transfer</h4><p>Access truffle console:</p><pre>$ truffle console</pre><p>On the console:</p><pre>var friendship = Friendship.deployed() // Note: the owner of the contract will be the first user on testrpc.</pre><h4>Transferring</h4><p>With the console open we call the function transfer and pass an address</p><pre>friendship.then(frn =&gt; frn.transfer(&#39;0xAA6a7242E2F0976f2402DAD991be5b43A189234B&#39;, 20000000)) // Foo address</pre><p>And now we can check the balance for 0xAA6a7..:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/1*EkpfiGIllAekReUowOUr-w.png" /></figure><h4><a href="https://github.com/marciok/friendship/">You can check the complete project on Github</a></h4><h3>Warning: Here we create a toy token, if you’re planning to create a token /coin for the main Ethereum network, make sure you write plenty of tests!</h3><h3>Conclusion</h3><p>To create and deploy a token on Ethereum, it is about creating a smart contract with some specific properties. In this tutorial our token is not doing much, but as you grow you can add more features like allowing another contract spend tokens on your behalf, check a full example on <a href="https://www.ethereum.org/token">Ethereum’s website </a>.</p><h3>Would you like to see more articles like this one? Help me with fuel, beer or coffee :)</h3><h3>My ETH Address: 0x7934759600724FeC279Df0b087322717bb9a1fC0</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e01c97b1dac0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitvest/how-to-create-a-token-coin-on-ethereum-e01c97b1dac0">How to create a token/coin on Ethereum</a> was originally published in <a href="https://medium.com/bitvest">BitVest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift & Ruby Interoperability]]></title>
            <link>https://medium.com/@MarcioK/swift-ruby-interoperability-9a0ce9a70fd2?source=rss-c74bd287bdff------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a0ce9a70fd2</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Marcio Klepacz]]></dc:creator>
            <pubDate>Wed, 15 Jun 2016 14:05:42 GMT</pubDate>
            <atom:updated>2016-06-15T14:05:42.802Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GXGSaWccalPUbDwrRsaOqA.png" /></figure><p>For the past years I favored Ruby for developing web applications. Ruby has tons of great frameworks that allows me to quickly develop and deploy for the web. With Swift for backend gaining momentum, I wondered: what If I wanted to migrate some code developed in Ruby — some shared business logic — into a shiny new Swift web app? Or what if I wanted to create some kind of framework in Swift and use it also in a Ruby project? On this blog post I’m going to set two examples on how I can you interoperate these two languages.</p><p><strong>Yes I understand, this can sound a bit of nonsense, but still, I was curious to see how could I validate the idea. Moreover how could I bridge these two languages.</strong></p><h3>1. Calling Ruby from Swift</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/153/1*ZYbNsUTCkDsi7SF_ap4Rvg.png" /></figure><p>Ruby has a <a href="https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h">C API</a>, that allows you to instantiate a Ruby VM, read <em>*.rb</em> files, call methods and <a href="https://silverhammermba.github.io/emberb/embed/">much more</a>. Technically what’s missing is a way to import <em>ruby.h</em> into Swift, the good news is that it can be easily done with <a href="https://github.com/apple/swift-package-manager">Swift Package Manager</a>, for instance take the <a href="https://github.com/marciok/CRuby"><em>CRuby</em></a> package. Its <em>Package.swift</em> is empty, the only thing that’s actually doing is pointing where your Ruby is installed on the <em>module.modulemap</em>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/114ffc50d75c5ec9839e6e1520112bd5/href">https://medium.com/media/114ffc50d75c5ec9839e6e1520112bd5/href</a></iframe><p>Now, let’s create a <a href="https://github.com/marciok/SwiftyRuby">project</a> and use the <em>CRuby</em> package:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d81c082f51785c1a897d9e2f61cdb4e/href">https://medium.com/media/5d81c082f51785c1a897d9e2f61cdb4e/href</a></iframe><p>And add the <em>hello.rb</em> file with a method that takes an argument and returns a string:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b4eaf257db441e2285fec44f21de526/href">https://medium.com/media/1b4eaf257db441e2285fec44f21de526/href</a></iframe><p>Finally, create some Swift code to call <em>hello.rb</em> using Ruby’s C API.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e30c50d51dc7e6ea0e0b146e32df753f/href">https://medium.com/media/e30c50d51dc7e6ea0e0b146e32df753f/href</a></iframe><p>And compile:</p><pre>RUBY_225_PATH=$RBENV_ROOT/versions/2.2.5 </pre><pre>swift build -Xcc -IRUBY_225_PATH/lib/include/ruby-2.2.0 \ <br>-Xcc -IRUBY_225_PATH/lib/include/ruby-2.2.0/x86_64-darwin15 \<br>-Xlinker -L$RUBY_225_PATH/lib</pre><p><strong>Note: The flag <em>-Xcc</em> is used to pass an option during all C compiler invocation, and <em>-Xlinker</em> is used pass an option through all linker invocations. This is only available on Swift 3.</strong></p><p>If everything worked you should be able to see:</p><pre>Hello Swift from Ruby!</pre><h3><strong>2. Calling Swift from Ruby</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/184/1*oxDvlIph07t2GJkxSpQ7-Q.png" /></figure><p>For the second part, where I want to call Swift from Ruby, I will use <a href="http://ruby-doc.org/stdlib-2.0.0/libdoc/fiddle/rdoc/Fiddle.html"><em>Fiddle</em></a><em>, </em>that is nothing more than a <a href="https://sourceware.org/libffi/">libffi</a> wrapper. Libffi is a popular C library which provides a portable interface that allows code written in one language to call code written in another language<em>.</em></p><p>With <em>Fiddle</em> we can call a dynamic library from a Ruby code. And for the Swift part, I can simply use the Swift Package Manager, that <a href="https://bugs.swift.org/browse/SR-33">recently introduced an option to compile to dynamic libraries</a> (*.dylib).</p><p>Example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e93b509da3e9fc0762a29ca713fdd07d/href">https://medium.com/media/e93b509da3e9fc0762a29ca713fdd07d/href</a></iframe><p>And on Ruby</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ca191b446ee1dad5fef9cc76f44f89c/href">https://medium.com/media/7ca191b446ee1dad5fef9cc76f44f89c/href</a></iframe><p>You will notice that I’m using the function’s mangled name, which I’ve found by running:</p><pre>nm -a .build/release/libPonyScale.dylib</pre><p><strong>At this point, I’m not sure how can I improve, in order to have a readable function name.</strong></p><p>Then, if you execute <em>pony_scale.rb </em>you will see the pony’s weight:</p><pre>Your pony weighs: 176.4</pre><h3>Conclusion</h3><p>So distant yet so close. As we know Swift and Ruby are two distinct languages. However, you can connect them without using any type of hack nor special framework — mainly because they share a common C ancestor. You can be happy if you encounter this issue on a future, where you have to create some bridge between your legacy Ruby project to a brand new Swift app.</p><h3>References</h3><ul><li><a href="http://blog.skylight.io/bending-the-curve-writing-safe-fast-native-gems-with-rust/">Bending the Curve: Writing Safe &amp; Fast Native Gems With Rust</a></li><li><a href="https://silverhammermba.github.io/emberb/embed/">Running Ruby in C</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a0ce9a70fd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift final methods under the hood]]></title>
            <link>https://medium.com/@MarcioK/swift-final-functions-under-the-hood-2deccd0b9437?source=rss-c74bd287bdff------2</link>
            <guid isPermaLink="false">https://medium.com/p/2deccd0b9437</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Marcio Klepacz]]></dc:creator>
            <pubDate>Wed, 03 Feb 2016 21:50:22 GMT</pubDate>
            <atom:updated>2016-02-03T21:57:53.448Z</atom:updated>
            <content:encoded><![CDATA[<p>In Swift you have many ways to mark your methods, you can make them: public, private, mutable, <strong>final</strong> and etc… On this post I’m going to investigate more deeply what happens when a method is marked as final<strong>. </strong>I’ll do it by looking into the Swift intermediate Language (SIL) code that is generated when a method is tagged as final and compare to when it’s not.</p><h4>What the final keyword means?</h4><p>If a method, property, or subscript is marked as final it cannot be overridden. Classes can also be marked as final. Any attempt to subclass a final class is reported as a compile-time error. On this post I will focus only on methods as I believe this is the most common use case. <a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Inheritance.html">Here is Apple’s documentation on the topic.</a></p><h4>Example:</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f477443120ac4078878beb3be1d4d80e/href">https://medium.com/media/f477443120ac4078878beb3be1d4d80e/href</a></iframe><h4>Now without final</h4><p>Let’s create a class with a method without final, call it and analyse it’s Swift intermediate Language code</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2434e022d620bb6ed34b6ae09d4c1818/href">https://medium.com/media/2434e022d620bb6ed34b6ae09d4c1818/href</a></iframe><h4>Swift intermediate Language (SIL)</h4><p>Swift has its own intermediate language, which is used by the Swift optimiser to perform specific language optimisations. — If you want to know more about SIL I recommend this <a href="http://swiftc.io/post/132002781944/hello-sil">blog</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-KUhfd24NRvmah7aq86Quw.png" /><figcaption>Swift compilation pipeline. (<a href="http://llvm.org/devmtg/2015-10/slides/GroffLattner-SILHighLevelIR.pdf">http://llvm.org/devmtg/2015-10/slides/GroffLattner-SILHighLevelIR.pdf</a>)</figcaption></figure><h4>Generating SIL code</h4><pre>$&gt; swiftc -emit-silgen pony.swift | xcrun swift-demangle &gt; pony.sil</pre><pre># 1. `-emit-silgen` will generate raw SIL mangled code.<br># 2. `xcrun swift-demangle` to demangle.</pre><h4>Result</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/373da0c76bc47ecb9745e3be2133fae4/href">https://medium.com/media/373da0c76bc47ecb9745e3be2133fae4/href</a></iframe><h4>What’s going on?</h4><ul><li>(line 8) Main is the program entry point</li><li>(line 12) Allocating new Pony instance</li><li>(line 15) Accessing `genus()` method by it’s index on the <a href="https://en.wikipedia.org/wiki/Virtual_method_table">virtual table</a></li><li>(line 16) Applying `genus()` to a pony instance</li><li>(line 34) Defining a <a href="https://en.wikipedia.org/wiki/Virtual_method_table">virtual table function</a> for Pony class methods</li></ul><h4>Adding final</h4><p>I will add final on `genus()` and regenerate SIL.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/81dbc5813318010ff0bbec8a8a990287/href">https://medium.com/media/81dbc5813318010ff0bbec8a8a990287/href</a></iframe><h4>Result</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/606db9be62c92110662e21a74efc7400/href">https://medium.com/media/606db9be62c92110662e21a74efc7400/href</a></iframe><h4>What changed?</h4><p>Since the compiler knows that there is no other class that could override `genus()` it deletes the reference on the virtual table; Adds `function_ref` to access `genus()` method directly; And removes `class_method` that looks for a function by it’s offset on the virtual table.</p><h4>Concluding</h4><p>Adding final to your method it means more than just a compile time error. It will internally optimise your code, it will generate a more efficient representation, furthermore it can result into a faster execution. Next time that you create a method and you are not expecting to be overridden remember to mark as final.</p><h4>References</h4><ul><li><a href="http://swiftc.io/">swiftc</a></li><li><a href="http://arstechnica.com/apple/2014/10/os-x-10-10/22/">OS X 10.10 Yosemite: The Ars Technica Review</a></li><li><a href="https://proto.mikeash.com/pyblog/friday-qa-2014-07-04-secrets-of-swifts-speed.html">mikeash.com: Friday Q&amp;A 2014-07-04: Secrets of Swift&#39;s Speed</a></li><li><a href="https://github.com/lexchou/swallow/tree/master/docs/en/sil-3-instruction-references">lexchou/swallow</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2deccd0b9437" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Opening links on the simulator from the terminal]]></title>
            <link>https://medium.com/@MarcioK/opening-links-on-the-simulator-from-the-terminal-16d67b436e84?source=rss-c74bd287bdff------2</link>
            <guid isPermaLink="false">https://medium.com/p/16d67b436e84</guid>
            <dc:creator><![CDATA[Marcio Klepacz]]></dc:creator>
            <pubDate>Mon, 03 Aug 2015 18:52:51 GMT</pubDate>
            <atom:updated>2016-01-17T17:36:20.145Z</atom:updated>
            <content:encoded><![CDATA[<p>A useful tip especially if have to test deep links: You can open them on iOS simulator from the command line using <strong>xcrun.</strong> Open your terminal and type:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5e1a523b840b7318662f95c84976183/href">https://medium.com/media/e5e1a523b840b7318662f95c84976183/href</a></iframe><h3>In depth</h3><p><strong>xcrun</strong> allows you to invoke developer tools from the terminal, in this case <strong>simctl</strong> which is a command line utility to control the iOS Simulator, simctl has the subcommand: <strong>openurl </strong>to open URLs in a given simulator, most of the cases you would like to open on the current booted device, so you add the flag <strong>booted </strong>or type the simulator id.</p><h3>Other stuff you can do with simctl:</h3><p><strong>create:</strong> Create a new device.<br><strong>delete:</strong> Delete a device.<br><strong>erase:</strong> Erase a device’s contents and settings.<br><strong>boot:</strong> Boot a device.<br><strong>shutdown:</strong> Shutdown a device.<br><strong>rename:</strong> Rename a device.<br><strong>getenv:</strong> Print an environment variable from a running device.<br><strong>openurl:</strong> Open a URL in a device.<br><strong>addphoto:</strong> Add photos to the photo library of a device.<br><strong>install:</strong> Install an app on a device.<br><strong>uninstall:</strong> Uninstall an app from a device.<br><strong>launch:</strong> Launch an application by identifier on a device.<br><strong>spawn:</strong> Spawn a process on a device.<br><strong>list:</strong> List available devices, device types, or runtimes.<br><strong>icloud_sync:</strong> Trigger iCloud sync on a device.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16d67b436e84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2015 UIKonf Notes]]></title>
            <link>https://medium.com/@MarcioK/2015-uikonf-notes-e635f342ddb1?source=rss-c74bd287bdff------2</link>
            <guid isPermaLink="false">https://medium.com/p/e635f342ddb1</guid>
            <dc:creator><![CDATA[Marcio Klepacz]]></dc:creator>
            <pubDate>Wed, 27 May 2015 17:35:10 GMT</pubDate>
            <atom:updated>2015-07-07T12:01:35.008Z</atom:updated>
            <content:encoded><![CDATA[<p>UIKonf was one of a kind, it combined: high level talks + great networking + good wifi signal. It was my first time there and I’m looking forward for next year.</p><h3><a href="http://www.uikonf.com/speakers/#Mike-Lee">Mike Lee</a> — “World Modeling”</h3><ul><li>The modern world will collapse if we don’t change and become more sustainable according to <a href="http://www.ep.liu.se/ecp/096/050/ecp14096050.pdf">this paper</a>.</li><li>You can use a programming language called <a href="https://www.modelica.org/"><strong>Modelica</strong></a><strong> </strong>to help you model complex system based on equations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*Uix9LmM2ecgHp9N8PJ9oKg.jpeg" /></figure><h3><a href="http://www.uikonf.com/speakers#Natasha-Murashev">Natasha Murashev</a> — “Swift Thinking”</h3><ul><li>Should use more <a href="http://en.wikipedia.org/wiki/Value_type">value type</a>, e.g use classes only when you need a mutating object (you need to keep a state) for the other cases Structs are better.</li><li>Enums and tuples are also <a href="http://en.wikipedia.org/wiki/Value_type">value types</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*dKaBxsFYFzJ5OLqxWZUGZQ.jpeg" /></figure><p><a href="http://www.slideshare.net/natashatherobot/swift-thinking"><strong>Slides</strong></a><strong>.</strong></p><h3>Reactive Native Workshop by Facebook</h3><p>Reactive Native is a very powerful and promising technology, Nick Lockwood gave a small workshop on how to use the framework.</p><ul><li><em>“Functional UI”: </em>Takes a state and returns a view.</li><li>It uses <a href="https://code.facebook.com/posts/1505962329687926/flow-a-new-static-type-checker-for-javascript/">Flow</a> to make Javascript “safer”.</li><li>You can describe your view using <a href="https://facebook.github.io/react/docs/jsx-in-depth.html">JSX</a>.</li><li>The table view generated with React Native doesn’t support view recycle but removes the cell view when it is not visible.</li><li>You can have Reactive Native + native code on the same project.</li></ul><h3><a href="http://www.uikonf.com/speakers#Claus-Hoefele">Claus Höfele</a> — “Practical WatchKit Development&quot;</h3><ul><li>You can use <a href="https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/MacOSXNotifcationOv/DarwinNotificationConcepts/DarwinNotificationConcepts.html">Darwin Notification Center</a> to communicate between the phone and watch.</li><li>The <strong></strong>WATCH apps should complement the user interface. (an extension of the phone app)</li></ul><p><a href="https://speakerdeck.com/choefele/practical-watchkit-development-uikonf-2015"><strong>Slides.</strong></a></p><h3><a href="http://www.uikonf.com/speakers#Marcel-Weiher">Marcel Weiher</a> — “Software Architecture in iOS and OS X applications”</h3><ul><li>Swift helps developers to solve problem on a more “algorithmic layer” rather than the daily basis UI problems.</li><li>Objective-C + Smalltalk = <a href="http://objective.st/">objective-smalltalk</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*OSl6fsl7U3yhMmCjeorGhw.jpeg" /></figure><p><a href="https://github.com/mpw/UIKonf-2015-Software-Arch"><strong>Slides</strong></a></p><h3><a href="http://www.uikonf.com/speakers#Tom-Adriaenssen">Tom Adriaenssen</a> — “Async View Controllers”</h3><ul><li>If you have to deal with very large and complex view, it is better to compose using small view controllers.</li><li><a href="https://github.com/Inferis/IIAsyncViewController#iiasyncviewcontroller">IIAsyncViewController</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*i8Ue0SuXnZovjVAOT5StxQ.jpeg" /></figure><p><a href="https://speakerdeck.com/inferis/async-view-controllers"><strong>Slides</strong></a><strong>.</strong></p><h3><a href="http://www.uikonf.com/speakers#JP-Simard">JP Simard</a> — “Fixing the Swift Tooling Problem”</h3><ul><li>The community can work on the fill the lack of tooling for Swift.</li><li><a href="http://stevenygard.com/projects/class-dump/">Class-dump</a> to do some reverse engineering.</li><li><a href="https://www.accelebrate.com/blog/thinking-swift-part-ii/">Swift Abstract Syntax Tree (AST)</a></li><li><a href="https://github.com/realm/SwiftLint">SwiftLint</a>.</li></ul><p><a href="https://speakerdeck.com/jpsim/fixing-the-swift-tooling-problem"><strong>Slides</strong></a></p><h3><a href="http://www.uikonf.com/speakers#Ash-Furrow">Ash Furrow</a> — “Teaching and Learning”</h3><p>Very inspiring talk on why you should aways blog and contribute to open source.</p><ul><li>Should blog on daily or weekly basis.</li><li>Contribute to the community.</li></ul><p><a href="https://speakerdeck.com/ashfurrow/teaching-and-learning"><strong>Slides</strong></a></p><h2>2nd day</h2><h3><a href="http://www.uikonf.com/speakers#Halle-Winkler">Halle Winkler</a> — “Duct-taping the gates of chaos shut: the weird, little, useful, sustainable indie (by design)”</h3><ul><li><a href="http://www.politepix.com/openears/">OpenEars</a></li><li><a href="https://github.com/Halle/HWHorrorShow">HWHorrorShow</a></li><li>If you are very worried about a problem you should stop, think deeply about it, what is the worst thing that can happen and how will you going to deal with it for about 4–5 minutes and then stop thinking about that and move on.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*9bZI4g_PQC5CJNfWFINq1w.jpeg" /></figure><h3><a href="http://www.uikonf.com/speakers#Brian-Gesiak">Brian Gesiak</a> — “iOS API Design: Swift Patterns”</h3><ul><li><a href="http://en.wikipedia.org/wiki/Kent_Beck">Kent Beck</a>: “<a href="https://youtu.be/ShOMGASbcJ0?t=48m45s">It’s all about trade-offs</a>” when deciding which a pattern to use.</li><li>Composing X Subclassing — Composing is more preferable.</li><li>Prefer immutability.</li><li>Use @avalibilty when deprecating code.</li><li>Use typealias.</li><li><a href="https://github.com/jverdi/JVFloatLabeledTextField">JVFloatLabeledTextField</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*X5wJhMDbhoPD51JubwQwSA.jpeg" /></figure><p><a href="https://speakerdeck.com/modocache/uikonf-2015-ios-api-design"><strong>Slides</strong></a></p><h3><a href="http://www.uikonf.com/speakers#Joe-Burgess">Joe Burgess</a> — “Learning Swift Through Lessons in Haskell”</h3><ul><li>Some intersting Haskell frameworks: <a href="http://www.yesodweb.com/">Yesod</a>, <a href="https://hackage.haskell.org/package/heist">Heist</a>, <a href="https://hackage.haskell.org/package/blaze-html">Blaze</a>, <a href="http://snapframework.com/">Snap</a>.</li><li>You can use Enums to have a <a href="http://en.wikipedia.org/wiki/Pattern_matching">pattern matching</a>.</li><li><a href="http://en.wikipedia.org/wiki/Partial_application">Partial application</a></li></ul><p><a href="https://github.com/jmburges/Haskel-concepts-in-swift"><strong>Slides</strong></a></p><h3><a href="http://www.uikonf.com/speakers#Chris-Eidhof">Chris Eidhof</a> — “Functional View Controllers”</h3><ul><li><a href="https://github.com/chriseidhof/github-issues">Functional View Controllers</a></li><li><a href="https://www.youtube.com/watch?v=rJosPrqBqrA">Andy Matuschak — Functioning as a Functionalist</a></li></ul><h3><a href="http://www.uikonf.com/speakers#Jens-Ravens">Jens Ravens</a> — “Functional Reactive Programming without Black Magic — Build your own ReactiveCocoa from scratch”</h3><p><a href="http://www.slideshare.net/jensravens/functional-reactive-programming-without-black-magic"><strong>Slides</strong></a></p><h3><a href="http://www.uikonf.com/speakers#Saniul-Ahmed">Saniul Ahmed</a> — “Prototyping Touch Interfaces (and my open-source story)”</h3><ul><li><a href="https://github.com/Khan/Prototope">Prototope</a></li></ul><h3><a href="http://www.uikonf.com/speakers#Maxim-Cramer">Maxim Cramer</a> — “A Journey into Design”</h3><ul><li>Think about design upfront before doing (like code)</li><li>A design should be consistent.</li><li><a href="http://www.amazon.com/Design-Hackers-Reverse-Engineering-Beauty/dp/1119998956">Design Hackers</a>.</li></ul><h3><a href="http://www.uikonf.com/speakers#Graham-Lee">Graham Lee</a> — “Object-Oriented Programming in Objective-C”</h3><p>Very powerful talk and I think biggest take way is:</p><p><strong>KNOW YOUR PARADIGM</strong>: If your are doing O.O write code that is O.O don’t fall into traps that make you write Procedural Programming with an O.O language, think about object sending messages, methods shouldn’t return void.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*7p4Kf7120UAuZ3sGQLNhag.jpeg" /></figure><h2>Other reviews:</h2><ul><li><a href="http://www.thetawelle.de/?p=4631">http://www.thetawelle.de/?p=4631</a></li><li><a href="https://iandundas.ghost.io/thoughts-on-uikonf-2015/">https://iandundas.ghost.io/thoughts-on-uikonf-2015/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e635f342ddb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Testing View Controllers with Quick and Nimble]]></title>
            <link>https://medium.com/ios-os-x-development/how-you-can-test-view-controllers-with-quick-nimble-328f895b55ee?source=rss-c74bd287bdff------2</link>
            <guid isPermaLink="false">https://medium.com/p/328f895b55ee</guid>
            <dc:creator><![CDATA[Marcio Klepacz]]></dc:creator>
            <pubDate>Mon, 11 May 2015 19:53:35 GMT</pubDate>
            <atom:updated>2017-03-29T01:59:32.632Z</atom:updated>
            <content:encoded><![CDATA[<p>View controllers are one of the pillars of your application architecture. T<a href="http://www.objc.io/issue-15/behavior-driven-development.html">hey are the place where the user interface connects with the app logic and model</a>. On them it can be sensible pieces of code that if modified could cause a substantial damage, making it an important place to be tested. Although, write tests for view controllers it is still an obscure topic, on this tutorial I will try to clarify that, with an example using <a href="https://github.com/Quick/Quick">Quick and Nimble</a>.</p><h4>Quick and Nimble</h4><p><strong>Quick </strong>is a <a href="http://en.wikipedia.org/wiki/Behavior-driven_development">behavior-driven development</a> framework for Swift and Objective-C. Inspired by <a href="https://github.com/rspec/rspec">RSpec</a>, <a href="https://github.com/specta/specta">Specta</a>, and <a href="https://github.com/onsi/ginkgo">Ginkgo</a>.</p><p><strong>Nimble </strong>is a Matcher Framework also for also both languages.</p><p>In another words Quick is a framework for creating <a href="http://en.wikipedia.org/wiki/Behavior-driven_development"><strong>BDD</strong></a> tests that comes with Nimble that can help to provide more clear expectations for your tests.</p><h3>The Example</h3><p>The example will be an iOS app written in Swift 1.2, named Pony. The app has a tab-bar and a view controller as the app intro that will be prompted when the app starts, the Main.storybard look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*coDmMhq3NgRj0Unl_2EFCg.png" /></figure><p>and running:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*9HuloDCQQ3Ul2t4KGQGkYg.gif" /><figcaption>Th</figcaption></figure><ol><li>Loaded.</li><li>Intro is prompted.</li></ol><h3>Setting up Quick and Nimble on Pony app</h3><p>If you have the latest <a href="http://cocoapods.org/">CocoaPods</a> version installed, you just have to add them in the Podfile:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5a77927055023f2908caff72d803b6f/href">https://medium.com/media/b5a77927055023f2908caff72d803b6f/href</a></iframe><h4>Quick File Templates (Optional)</h4><p><em>You can install using Alcatraz or </em><a href="https://github.com/Quick/Quick/blob/master/Documentation/en-us/InstallingFileTemplates.md"><em>manually with via the Rakefile</em></a></p><h4>Attention!</h4><p><strong>Before you start make sure the class is public, e.g:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a642e7ca0ecac2cfe1c9b880b1186d2/href">https://medium.com/media/7a642e7ca0ecac2cfe1c9b880b1186d2/href</a></iframe><h4>Creating a test class</h4><p>If the Quick templates are installed you can just go: create a new file and select quick template and import the app module, e.g:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b42621fc6653a5a95dc48086a902c69a/href">https://medium.com/media/b42621fc6653a5a95dc48086a902c69a/href</a></iframe><h3>Testing</h3><h4>PonyTabController: UITabBarController</h4><p>PonyTabController is a UITabController subclass that is responsible for presenting the app intro if it hasn’t already and dismiss-it if the delegate is called.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d1dcb16834d45fb901e2fcee9885cfb/href">https://medium.com/media/8d1dcb16834d45fb901e2fcee9885cfb/href</a></iframe><p>Let’s start with our first expectation on viewDidAppear:</p><p><strong><em>“When app intro had never been dismissed it should be set as the appIntroDelegate”</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7fde436bc9abf886632daf706863d41c/href">https://medium.com/media/7fde436bc9abf886632daf706863d41c/href</a></iframe><p>Now we have the expectation described but there are some things missing, there is no assertion or setup for the object that we want to test (an instance of PonyTabController) and it is not being invoked by any method. In order to setup that more clearly we can divided the test code into three groups: <strong>Arrange</strong>, <strong>Act</strong>, <strong>Assert</strong>, for example:</p><p><strong>Arrange:</strong></p><ul><li>Create a instantiate a PonyTabController.</li></ul><p><strong>Act:</strong></p><ul><li>Trigger the instance of the PonyTabController lifecycle .</li></ul><p><strong>Assert:</strong></p><ul><li>tabController should be the appIntroViewController delegate</li></ul><p>resulting:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5f3345c527970fd538b1f20c43da02b/href">https://medium.com/media/a5f3345c527970fd538b1f20c43da02b/href</a></iframe><p>Organising the test code on this way its best known as the: “<a href="http://c2.com/cgi/wiki?ArrangeActAssert\">Arrange-Act-Assert</a>” pattern and some benefits are:</p><ul><li>Clearly separates what is being tested from the setup and verification steps.</li><li>Clarifies and focuses attention on a historically successful and generally necessary set of test steps.</li></ul><p>Now doing the same for:</p><p>“<strong><em>When app intro had never been dismissed it should be presented</em></strong><em>”</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de880f31d2a3687dd77d4608ab847712/href">https://medium.com/media/de880f31d2a3687dd77d4608ab847712/href</a></iframe><p>and</p><p>“<strong><em>When app intro had never been dismissed and appIntroDidFinish</em></strong> <strong><em>is</em></strong> <strong><em>called it should dismiss app intro</em></strong><em>”</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c7b0c31ae363845f7228546110cb91d7/href">https://medium.com/media/c7b0c31ae363845f7228546110cb91d7/href</a></iframe><p>Little brief about “describe” and “context”:</p><p><strong>Describe</strong>: wrap a set of <strong>tests against one functionality</strong></p><p><strong>Context: </strong>wrap a set of tests against <strong>one functionality</strong> <strong>under the same state</strong>.</p><p>Concluding the tests for PonyTabController.</p><p><strong>You can </strong><a href="https://github.com/getyourguide/Pony"><strong>check the full project here.</strong></a></p><h3>Extra</h3><p>Nimble comes with the function <a href="https://github.com/Quick/Nimble#asynchronous-expectations"><em>waitUntil</em></a> where you can execute something inside it closure and call <em>done() </em>when is ready, if <em>done()</em> is not called within a second the test will fail, if you need to extend that interval the function accepts a timeout parameter where you can specify for how long the function will wait until it fails. It could be handy when you want to wait for a view controller to be presented, e.g:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bde0ad9f2706b7c8a75d9fcb9cc96d56/href">https://medium.com/media/bde0ad9f2706b7c8a75d9fcb9cc96d56/href</a></iframe><h3>Concluding</h3><ul><li>You can use Quick and Nimble to help you achieve more meaningful tests with clearer expectation.</li><li>There is a lifecycle that must be followed, i.e: you can’t present a view controller if there another already being presented or the view is not part of the hierarchy.</li><li>UIKit provide public methods to help trigger view controller states.</li><li>Testing on view controllers can be tricky sometimes, try to keep them thin as possible ☺</li></ul><h3>Links</h3><ul><li><a href="http://www.objc.io/issue-15/behavior-driven-development.html">www.objc.io/issue-15/behavior-driven-development.html</a></li><li><a href="http://www.slideshare.net/bgesiak/everything-you-never-wanted">http://www.slideshare.net/bgesiak/everything-you-never-wanted</a></li><li><a href="http://realm.io/news/testing-in-swift/">http://realm.io/news/testing-in-swift/</a></li><li><a href="https://github.com/Quick/Quick">https://github.com/Quick/Quick</a></li></ul><h3>Special thanks</h3><p><a href="https://twitter.com/eldudi">@eldudi</a> and <a href="https://twitter.com/banaslee">@banaslee</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=328f895b55ee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ios-os-x-development/how-you-can-test-view-controllers-with-quick-nimble-328f895b55ee">Testing View Controllers with Quick and Nimble</a> was originally published in <a href="https://medium.com/ios-os-x-development">iOS App Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>