<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Urls on Andy Ibanez</title><link>https://www.andyibanez.com/tags/urls/</link><description>Recent content in Urls on Andy Ibanez</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 04 Sep 2019 07:00:00 -0400</lastBuildDate><atom:link href="https://www.andyibanez.com/tags/urls/index.xml" rel="self" type="application/rss+xml"/><item><title>Building URLs With NSURLComponents</title><link>https://www.andyibanez.com/posts/building-urls-with-nsurlcomponents/</link><pubDate>Wed, 04 Sep 2019 07:00:00 -0400</pubDate><guid>https://www.andyibanez.com/posts/building-urls-with-nsurlcomponents/</guid><description>&lt;p&gt;If you have been programming for Apple platforms for a while, chances are you have seen (or maybe even wrote yourself) a line of code that looks like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-swift" data-lang="swift"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f38ba8"&gt;let&lt;/span&gt; &lt;span style="color:#f5e0dc"&gt;url&lt;/span&gt; = URL(string: &lt;span style="color:#a6e3a1"&gt;&amp;#34;https://www.google.com/search?hl=en&amp;amp;q=pullip&amp;#34;&lt;/span&gt;)&lt;span style="color:#89dceb;font-weight:bold"&gt;!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Whether you wrote it yourself or someone else did it, one thing is clear: This is not a safe way to build URLs. Can you know, for sure, that your URL is actually valid? Intuitively, all of us can see a URL and see if it&amp;rsquo;s valid, but there is a &lt;a href="http://www.faqs.org/rfcs/rfc1738.html"&gt;whole lot of governing&lt;/a&gt; in the URL format that at some point we may find funny URLs that look valid and aren&amp;rsquo;t, or the other way around; they look invalid, but aren&amp;rsquo;t.&lt;/p&gt;</description></item></channel></rss>