<?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 David Luque on Medium]]></title>
        <description><![CDATA[Stories by David Luque on Medium]]></description>
        <link>https://medium.com/@daviluqui?source=rss-31b6f630b1d4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7THLTF8Do3u7CHsei2BD6A.jpeg</url>
            <title>Stories by David Luque on Medium</title>
            <link>https://medium.com/@daviluqui?source=rss-31b6f630b1d4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 02:06:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@daviluqui/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[Novedades de ECMAScript 2021]]></title>
            <link>https://medium.com/nosolosoftware/novedades-de-ecmascript-2021-21268cdefb3?source=rss-31b6f630b1d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/21268cdefb3</guid>
            <category><![CDATA[ecmascript]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[novedades]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[David Luque]]></dc:creator>
            <pubDate>Mon, 06 Sep 2021 12:52:21 GMT</pubDate>
            <atom:updated>2021-09-06T12:52:21.774Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ly6Y0vMENyYOIxrZg-Wfww.png" /></figure><p>La nueva versión de Javascript (ES12 o ECMAScript 2021) que está siendo definida por ECMA y que fue aprobada en junio, trae consigo las siguientes novedades que se pueden consultar <a href="https://github.com/tc39/proposals/blob/master/finished-proposals.md">aquí</a>.</p><h3>Promise.any</h3><p>Promise.any será el cuarto combinador de promesas de Javascript. Éste recibe un conjunto de promesas iterables y retornará aquella primera que se resuelva. Cuando todas ellas son rechazadas, obtenemos un AggregateError que nos comunica por qué han fallado</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d8e4e10713b6944a19a9c4a57359bbd/href">https://medium.com/media/8d8e4e10713b6944a19a9c4a57359bbd/href</a></iframe><p><a href="https://github.com/tc39/proposal-promise-any">Documentación</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Hiu9APKu18FBXZq8kyddw.png" /></figure><h3>String.prototype.replaceAll</h3><p>Esta nueva función viene a suplir la necesidad de reemplazar varias subcadenas dentro de una misma cadena. Ahora mismo la única forma para hacer reemplazos es usar `replace` con una regex global.</p><p>La función `replace` sólo afecta a la primera coincidencia dentro de la cadena, pero con `replaceAll` podremos cambiar todas</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a80b817cc943763517e12528c19360d7/href">https://medium.com/media/a80b817cc943763517e12528c19360d7/href</a></iframe><p><a href="https://github.com/tc39/proposal-string-replaceall">Documentación</a></p><h3>WeakRefs &amp; FinalizationRegistry</h3><p>Una de las tareas transparentes que ejecuta Javascript es la del recolector de basura. La idea es que periódicamente se limpien ciertas variables que no se están usando para aliviar el peso de la aplicación y mejorar la gestión de la memoria. Ahora, nosotros podremos definir ciertas variables débiles que tendrán prioridad para ser eliminadas por el sistema cuando el recolector se ejecute.</p><p>Podremos diferenciar entre las variables de siempre, con const, let o var que tendrán referencias fuertes, y las nuevas débiles que usarán una instancia de WeakRef que nos permitirá almacenar datos voluminosos pero no esenciales en nuestra ejecución que serán limpiados antes.</p><p>Desde la documentación nos recuerdan que la implementación tanto de WeakRef como de FinalizationRegistry es bastante profunda y recomiendan que no se implementen si no es realmente necesario.</p><p><a href="https://github.com/tc39/proposal-weakrefs">Documentación</a></p><h3>Operadores de asignación lógica</h3><p>En la asignación AND lógica, `a` valdrá 2 sólo en el caso de que su valor sea reconocido como true</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d907b32a215355c33f534d4750ed253a/href">https://medium.com/media/d907b32a215355c33f534d4750ed253a/href</a></iframe><p>Con la asignación OR lógica, si `a` tiene un valor previo a la asignación se mantendrá ese valor y sino tendrá el que se le de en este momento</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5ef0b272a4fa2ab6596052aff9561ab/href">https://medium.com/media/b5ef0b272a4fa2ab6596052aff9561ab/href</a></iframe><p>Incluso, podemos usar el operador ??= para asignar valores y eliminar nulos.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d7d4445465b82bdc18651af42566b57/href">https://medium.com/media/6d7d4445465b82bdc18651af42566b57/href</a></iframe><p><a href="https://github.com/tc39/proposal-logical-assignment">Documentación</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cswr1Ji21FxE76qricE6QA.png" /></figure><h3>Separadores numéricos</h3><p>Ahora podremos separar las unidades de grandes números de una forma sencilla y que haga más fácil su lectura</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eaa3cbe8a9d7a8c9792f633c367ecd6d/href">https://medium.com/media/eaa3cbe8a9d7a8c9792f633c367ecd6d/href</a></iframe><p><a href="https://github.com/tc39/proposal-numeric-separator">Documentación</a></p><h3>Métodos privados para clases (incluso getters y setters)</h3><p>Con esta nueva implementación podremos añadir a nuestras clases Javascript tanto variables como métodos privados con lo que aumentamos el encapsulamiento de las clases y privacidad de los datos.</p><p>La forma de hacer privados tanto atributos como métodos será añadir # delante de su nombre.</p><p>Atributo y getter/setter públicos</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/68147a6efeba94eebefe9b2163b42313/href">https://medium.com/media/68147a6efeba94eebefe9b2163b42313/href</a></iframe><p>Atributo y getter/setter privados</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/96ea6b3fb36201be832f1280c768b431/href">https://medium.com/media/96ea6b3fb36201be832f1280c768b431/href</a></iframe><p><a href="https://github.com/tc39/proposal-private-methods">Documentación</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21268cdefb3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nosolosoftware/novedades-de-ecmascript-2021-21268cdefb3">Novedades de ECMAScript 2021</a> was originally published in <a href="https://medium.com/nosolosoftware">NoSoloSoftware</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working with ScrollView and AutoLayout]]></title>
            <link>https://medium.com/@daviluqui/working-with-scrollview-and-autolayout-4119baaaf0d1?source=rss-31b6f630b1d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/4119baaaf0d1</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[autolayout]]></category>
            <category><![CDATA[swift-3]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[David Luque]]></dc:creator>
            <pubDate>Fri, 21 Jul 2017 08:39:02 GMT</pubDate>
            <atom:updated>2017-07-21T08:39:02.947Z</atom:updated>
            <content:encoded><![CDATA[<p>Working with AutoLayout is very funny while you’re building your simple UI with UILabel, UIImageView and more, but when it’s time to implement a ScrollView, I can guarantee to you it’s not!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/175/1*Rc0r_LOksBfufvq0R4DadQ.png" /></figure><p>The first thing you must know when you want to implement a ScrollView is this, It’s very difficult even to Apple Engineers.</p><p>So, first we must drop a ScrollView in our View Controller. And now, we start to configure the constraints of the ScrollView and the children.</p><h3><strong>Setting the ScrollView constraints</strong></h3><p>First of all, we must adjust the ScrollView to the parent. So we click on the “Add new Constraint” button and we fill it with:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*fYe1Yq3gMpaCk-0kQl_zaQ.png" /></figure><p>Now we drop a new View inside the ScrollView, this will be the container to our content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/249/1*lx8DKLVW__MX_9TiC8Tl2w.png" /></figure><h3><strong>Setting Content View constraints</strong></h3><p>Now, the second step is to set the constraints of the Content view inside the ScrollView.</p><p>First of all, we must define the width of the Content View, then the parent (ScrollView) will adjust to this width.</p><p>For this, we must set a “Equal widths” constraint in the Container View with the Parent View. We press Control + Drag to View and click in “Equal widths”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*RaZ38pjz7ESHUZ_QK6Tt-g.png" /></figure><p>Now, we add new Constraints to the Content View to adjust it to the ScrollView.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*fB81mOdt7yHha0jf_eyrQA.png" /></figure><p>We must have the View this way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*dlVDNMU7JkFCHNo1fskD0A.png" /></figure><h3><strong>Adding content to Content View</strong></h3><p>Now, we just drop an UILabel inside the Content View. The constraints in the label are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*gOfDf5o9r74qoVGAl325lw.png" /></figure><p>And magic happens! We have a ScrollView installed without any problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*_0HfAYEpwadCdWqcMWXW_w.png" /></figure><h3><strong>Important</strong></h3><p>If you forget to add content in the Content View, you must center horizontally and vertically the view, or Xcode will notify you an alert.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4119baaaf0d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>