<?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 Pavel  Plotnikov on Medium]]></title>
        <description><![CDATA[Stories by Pavel  Plotnikov on Medium]]></description>
        <link>https://medium.com/@pavelplotnikov?source=rss-78beb9c45e2d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aC4uXmusdekwCf25</url>
            <title>Stories by Pavel  Plotnikov on Medium</title>
            <link>https://medium.com/@pavelplotnikov?source=rss-78beb9c45e2d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 20:56:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pavelplotnikov/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 ranges work in Swift]]></title>
            <link>https://itnext.io/how-ranges-work-in-swift-572cdec620e9?source=rss-78beb9c45e2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/572cdec620e9</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[range]]></category>
            <dc:creator><![CDATA[Pavel  Plotnikov]]></dc:creator>
            <pubDate>Mon, 14 Feb 2022 14:54:52 GMT</pubDate>
            <atom:updated>2022-02-14T14:54:52.946Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fvyYNEhgadhAGwDvk8tGrw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@sidseverin?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Sidney Severin</a> on <a href="https://unsplash.com/s/photos/range?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Ranges family of types may not seem to bring us surprises, but they hide exciting points in the implementation.</p><p>The Swift standard library has a family of Range types that we habitually use, like this:</p><pre>let array: Array&lt;Int&gt; = [0, 1, 2, 3, 4, 5]<br>array[...3]<br>array[...]<br>for i in 1..&lt;4 {<br>  print(i)<br>}</pre><p>We are used to operating literals like [1, 2, 3]or [1:2, 3:4] or &quot;some string&quot;. And we can declare our Range as letting r = 2..&lt;4. It looks like a literal, but it is a binary operator ..&lt; which has two parameters as input and a Range as output (the specific type of Range depends on the operator — binaries operators 1...10 and 1..&lt;10, unary operators ...10, ..&lt;10, and 1...)</p><p>Despite the similarities between the types of the Range family, all of them can have significant differences in implementation. However, at first glance, it may seem that the only difference is how the boundaries of the Range are specified.</p><p>Let’s understand how does Range works.</p><h3><strong>RangeExpression Protocol</strong></h3><p>Almost all Range types in Swift have one thing in common: they all conform to the <em>RangeExpression</em> protocol (except <em>UnboudedRange</em>). This protocol is capable of two things:</p><ul><li>First, it can check whether an element is included in a range (the <em>contains</em> function)</li><li>And the second function can convert any Range type (<em>PartialRangeUpTo</em>, <em>PartialRangeThrough</em>, <em>PartialRangeFrom</em>, <em>ClosedRange</em>) to the universal <em>Range</em> type (the <em>relative</em> function)</li></ul><p>Why do we need it? As you know, we’re able to refer to collections by a subscript. For instance:</p><pre>let array = [0, 1, 2, 3, 4, 5, 6, 7, 8]<br>array[1..&lt;3] <em>// operator 1..&lt;3 returns Range&lt;Int&gt;(lowerBound: 1, upperBound: 3), which we pass as input to the subscript</em><br>array[..&lt;3] // PartialRangeUpTo&lt;Int&gt;<br>array[...3] // PartialRangeThrough&lt;Int&gt;<br>array[1...3] // ClosedRange&lt;Int&gt;<br>array[1...] // PartialRangeFrom&lt;Int&gt;</pre><p>Different range types are passed to the subscript in all of these examples, so it isn’t good to implement a subscript for every kind of the range family in each collection.</p><p>The input subscript accepts the <em>RangeExpression</em> protocol. Before executing the subscript, the collection calls the <em>relative</em> function on the protocol, which converts the resulting range (<em>PartialRangeUpTo</em>, <em>PartialRangeThrough</em>, <em>PartialRangeFrom</em>, <em>ClosedRange</em>) into the universal <em>Range</em> type.</p><p>But there is one feature, we cannot convert absolutely any type of the range family to the <em>Range</em> type. For example, at the output, we cannot submit obj1...obj2 and get the universal <em>Range</em> obj1..&lt;obj3 (where <em>obj3</em> is the object following <em>obj2</em>) because we don’t know which object comes after <em>obj2</em>. But still, we can recognize the following element if <em>Bound</em> is an index in the <em>Collection</em> protocol</p><pre>func relative&lt;C: Collection&gt;(    to collection: C  ) -&gt; Range&lt;Bound&gt; where C.Index == Bound</pre><p>In this case, we may call <em>collection.index(after:)</em> and find out the next element to return the standard <em>Range</em>.</p><h3>Range</h3><p>The primary Range structure is very simple: two fields are stored in the lower and upper bound struct.</p><p>The only minimum requirement is these fields must be Comparable types. public struct Range&lt;Bound: Comparable&gt;. Let me remind you that <em>Comparable</em>, in turn, conforms to the <em>Equitable</em> protocol. Let’s suppose you want to implement your structure that conforms to <em>Comparable</em>. In that case, you must at least implement the &lt; operator (In case your structure does not meet the requirements of automatic synthesis of the <em>Equatable</em>, then you must also implement the == operator). The remaining operators &gt;, &lt;=, &gt;= are implemented by default based on the &lt; operator. So, you can create your own structure:</p><pre>+---------+---------------+<br>|  Body   | Diameter (km) |<br>+---------+---------------+<br>| Sun     |     1,391,000 |<br>| Mercury |         4,880 |<br>| Venus   |        12,104 |<br>| Earth   |        12,756 |<br>| Mars    |         6,794 |<br>| Jupiter |       142,984 |<br>| Saturn  |       120,536 |<br>| Uranus  |        51,118 |<br>| Neptune |        49,532 |<br>+---------+---------------+</pre><pre><strong>struct</strong> Planet: Comparable {<br>  <strong>static</strong> <strong>func</strong> &lt; (lhs: Planet, rhs: Planet) -&gt; Bool {<br>    <strong>return</strong> lhs.diameterKm &lt; rhs.diameterKm<br>  }<br>  <strong>let</strong> name: String<br>  <strong>let</strong> diameterKm: Double<br>}</pre><pre><strong>let</strong> mercury = Planet(name: &quot;Mercury&quot;, diameterKm: 4880)<br><strong>let</strong> earth = Planet(name: &quot;Earth&quot;, diameterKm: 12756)<br><strong>let</strong> neptune = Planet(name: &quot;Neptune&quot;, diameterKm: 49532)<br><strong>let</strong> jupiter = Planet(name: &quot;Jupiter&quot;, diameterKm: 142984)</pre><pre>mercury == neptune // false</pre><pre><strong>let</strong> planets = mercury..&lt;neptune</pre><p>We have created a <em>Range</em> from Mercury to Neptune. Earth is between these planets, but this range doesn’t include Neptune and Jupiter. We have only two planets in the <em>Range</em>, and based on a simple comparison operator, we can find out whether the object being checked is included in the <em>Range</em> or not:</p><pre>planets.contains(earth) // true<br>planets.contains(neptune) // false<br>planets.contains(jupiter) // false</pre><p>We can also return the intersection of two Ranges or check for a crossing.</p><pre>(mercury..&lt;neptune).clamped(to: earth..&lt;jupiter) // earth..&lt;neptune</pre><p>It is the very skeleton of the <em>Range</em> structure. Our simple range with custom bound types is limited to these functions; we can’t iterate or do anything else without extra effort. Range’s other features are implemented depending on what types conform to Range’s lower and upper bounds.</p><h3>Range can be a collection</h3><p><em>Range</em> can be a collection, but only if the bounds specified in range conform to the <em>Strideable</em> protocol, where stride is a <em>SignedInteger</em> (only <em>Strideable</em> is mentioned hereafter, also implying the restriction on <em>SignedInteger</em>).</p><p>If the boundaries of the <em>Range</em> conforms to <em>Stridable</em>, then the <em>Range</em> has new features inherent in the collections with which we are already familiar. For example, it becomes possible to iterate in a loop:</p><pre>for i in -1..&lt;8 {<br>  print(i)<br>}</pre><p>We’ve defined a <em>Range</em> in this case, but our <em>Range</em> will also be a <em>Sequence</em> because its bounds conform to the <em>Strideable</em> protocol.</p><p>We cannot write for p in mercury…jupiter for our planets because many functions, in this case, are not defined. We don’t know which planet follows which (our planets are not strideable).</p><p>The <em>Range</em> that conforms to <em>Strideable</em> has its type alias called <em>CountableRange</em>. Such a <em>Range</em> can be iterated and accessed by subscript. The regular <em>Range</em> (<em>Bound</em> not conform to <em>Strideable</em>) doesn’t have this feature; it has only two bounds and is limited only by the <em>RangeExpression</em> protocol capability.</p><p>You can work with <em>CountableRange</em> as with a regular collection, for example (3..&lt;5)[4], and in this case, the subscript must receive a value as a parameter, which itself is within the specified boundaries. Therefore, the expression (3..&lt;5)[0] won’t work, and we’ll have an error.</p><h3><strong>PartialRangeUpTo</strong> <strong>and</strong> <strong>PartialRangeThrough</strong></h3><p>These structures are very similar, and both contain an <em>upperBound</em> field. Regarding <em>PartialRangeUpTo</em>, the field is not included in the range, while it is in the case of <em>PartialRangeThrough</em>. Both of these entities don’t have a lower bound. Hence, they follow their feature related to the fact that these structures under no circumstances can conform to <em>Sequence</em> or <em>Collection</em> protocols. Therefore, you cannot iterate them or refer to them by subscript:</p><pre><strong>// </strong>this code will not compile<strong><br>for</strong> n <strong>in</strong> ...10 {<br>  print(n)<br>}<br><strong>for</strong> n <strong>in</strong> ..&lt;10 {<br>  print(n)<br>}<br>(...10)[9]<br>(..&lt;10)[9]</pre><p>Even this code won’t work: (..&lt;4).reversed(). We understand that we could define the starting element of the reversed sequence and iterate the remaining elements. Still, since <em>PartialRangeUpTo</em> does not conform to <em>Sequence</em>, this expression will not compile.</p><h3>PartialRangeFrom</h3><p>It is a Range family structure that has only a lower bound. We already have a start element, but no end element in this case. Therefore, if our lower bound is <em>Strideable</em>, we can implement the functions of the <em>Sequence</em> protocol, but we won’t be able to implement <em>Collection</em> on our structure due to the lack of an upper bound.</p><p>Let me remind you that <em>Sequence</em> has no limit on the number of elements, while the number of elements in a <em>Collection</em> must be finite. For <em>PartialRangeFrom</em>, the lower bound of which <em>Strideable</em> is typealias <em>CountablePartialRangeFrom</em>, and we can iterate it.</p><h3>ClosedRange</h3><p>It is the most unusual structure of the Range family in terms of realization. Like the regular <em>Range</em>, this structure can implement the <em>Sequence</em> and <em>Collection</em> protocol if the boundary parameters conform to <em>Strideable</em>. It would seem that compared to <em>Range</em>, there should be a minimal difference in the implementation of the <em>Collection</em> protocol. However, working with indexes is significantly different with such a minimal difference. The index for the collection in <em>ClosedRange</em> is defined as enum:</p><pre>public enum Index {<br>    case pastEnd<br>    case inRange(Bound)<br>}</pre><p>The index is an enum!</p><p>What could be the reason for such a difference in realization? The <em>Collection</em> protocol has an <em>endIndex</em> property. I emphasize that this is the upper bound of the collection, which is not included in the collection. Concerning a <em>Range</em> structure, <em>endIndex</em> is easily defined as the upper bound (<em>upperBound</em> property). In the claim of <em>ClosedRange</em>, <em>endIndex</em> can be defined as the index following the upper bound.</p><p>Since the upper bound must conform to <em>Stridable</em>, we can call it upperBound.advanced(by: 1). Everything seemed fine, but there is one small problem: <em>Int</em> values (which conform to <em>Strideable</em>) have a maximum Int.max value. As to a <em>ClosedRage</em> defined as, for example, 1...Int.max, the value of the <em>endIndex</em> property should be Int.max+1, but Int.max is already the maximum value. We could solve the problem by using an enum as indexes, where <em>endIndex</em> is just one of the cases in the enum. And the logic for working with indexes in the collection is implemented around this enum.</p><p>We can’t refer to (4...10)[5] as we do with a regular <em>Range</em>. But we can do this (4...10)[.inRange(5)], moreover, in the current implementation, with such a call, there are no checks for inclusion in <em>ClosedRange</em>. (4...11)[.inRange(3)] will return 3 (even though range does not contain 3), while (4...11)[3] will not work (because in ClosedRange index — enum).</p><p>It turns out that <em>ClosedRange</em> is the strangest collection in the standard libraries due to referring to its collection by a subscript; you need to use an unusual construction with enum.</p><pre>// ClosedRange<strong><br>let</strong> collection1 = 4...100<br>collection1[.inRange(-100)] // ok: -100<br>collection1[.inRange(5)] // ok: 5<br>// collection1[5] // compile error</pre><pre>// Range<strong><br>let</strong> collection2 = 4..&lt;100 <br>// collection2[.inRange(-100)] // compile error<br>// collection2[-100] // runtime error<br>collection2[5] // ok: 5</pre><p>But you should also note that it is recommended to work with collection indexes using the <em>startIndex</em>, <em>endIndex</em> properties, and functions for calculating indices <em>index(after:)</em>, <em>distance(from:to:)</em>, etc., defined on protocols of the <em>Collection</em> family. It’ll make your application safe at runtime and allow you to abstract away from specific implementations of indexes on all collection types.</p><pre>// a safe way to work with ranges<br><strong>let</strong> closedRange = 4...100<br>closedRange[closedRange.index(after: closedRange.startIndex)]//ok: 5</pre><h3>UnboundedRange</h3><p>Here is one more unusual type of the Range family. It’s a typealias which defines as public typealias UnboundedRange = (UnboundedRange_)-&gt;(). Enum <em>UnboundedRange_</em> is used as the namespace for the ... operator, which does absolutely nothing. It allows us to use such a collection[...] construction. We can see an example of this in the documentation with the solution of the recursive problem.</p><pre>func countLetterChanges(_ s1: Substring, _ s2: Substring) -&gt; Int {<br>  if s1.isEmpty { return s2.count }    <br>  if s2.isEmpty { return s1.count }     </pre><pre>  let cost = s1.first == s2.first ? 0 : 1     <br>  return min(<br>        countLetterChanges(s1.dropFirst(), s2) + 1,<br>        countLetterChanges(s1, s2.dropFirst()) + 1,<br>        countLetterChanges(s1.dropFirst(), s2.dropFirst()) + cost)<br>}</pre><pre>let word1 = &quot;grizzly&quot;<br>let word2 = &quot;grisly&quot;<br>let changes = countLetterChanges(word1[...], word2[...])<br>// changes == 2</pre><p>This type doesn’t conform to <em>RangeExpression</em> (the only exception for the Ranges family of classes), so <em>Collection</em> and <em>MutableCollection</em> have a separate subscript implementation for <em>UnboundedRange</em>.</p><p>It is essentially a tiny hack and is only needed so that in the subscript of collections, you can specify a range of the size of the collection itself.</p><h3>Summary</h3><p>We have explored all types of the Range family. These classes denote different combinations of defining the boundaries of ranges.</p><ul><li><strong>The <em>Range</em> and <em>ClosedRange</em></strong> types can conform to <em>Collection</em> if the bounds work to <em>Strideable</em> (the typealiases <em>CountableRange</em> and <em>CountableClosedRange</em> defined for such cases). But for <em>CountableClosedRange</em>, indexes are implemented unusually via enum because otherwise, when implementing some functions, there may be issues working with the maximum values of types.</li><li><strong>A <em>PartialRangeFrom</em></strong> type can conform to <em>Sequence</em> if the boundary conforms to <em>Strideable</em> (the typealias <em>CountablePartialRangeFrom</em> is defined for this case). But we cannot conform to this type of <em>Collection</em> due to the lack of an upper bound.</li><li><strong>The <em>PartialRangeUpTo</em> and <em>PartialRangeThrough</em></strong> types cannot have <em>Sequence</em> or <em>Collection</em> implementations because they don’t have a start index defined.</li><li><strong><em>UnboundedRange</em></strong> is a hack-type, which is needed exclusively to define a subscript on the <em>Collection</em> and <em>MutableCollection</em> by the operator ....</li></ul><p>You can see the implementation for ranges <a href="https://github.com/apple/swift/tree/main/stdlib/public/core">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=572cdec620e9" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/how-ranges-work-in-swift-572cdec620e9">How ranges work in Swift</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[4 Lesser-Known Swift Features]]></title>
            <link>https://medium.com/better-programming/4-lesser-known-swift-features-ddfbc9268aa9?source=rss-78beb9c45e2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddfbc9268aa9</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Pavel  Plotnikov]]></dc:creator>
            <pubDate>Tue, 25 Jan 2022 17:58:06 GMT</pubDate>
            <atom:updated>2022-01-25T17:58:06.791Z</atom:updated>
            <content:encoded><![CDATA[<h4>Do you know how to resolve dictionary collisions?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zk9Hx9X3WZ0uaLcs" /><figcaption>Photo by <a href="https://unsplash.com/@lazycreekimages?utm_source=medium&amp;utm_medium=referral">Michael Dziedzic</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Many developers work with standard technologies and are often unaware of the many outstanding features hidden under friendly languages ​​and libraries. These features may already be familiar for some readers, but it has been a small discovery lately for me.</p><h3>Tail Recursion Optimization</h3><p>Many developers know that recursion might be an imperfect tool, as the function call stack can overflow uncontrollably and crash due to a Segmentation fault. One type of recursion is Tail Recursion, where a function calls itself at the end of the function itself.</p><pre><strong>func</strong> tailRecursion(n: Int) {<br>  <strong>guard</strong> n != 0 <strong>else</strong> { <strong>return </strong>}<br>  print(n)<br>  tailRecursion(n: n-1)<br>}</pre><p>in contrast with usual recursion:</p><pre><strong>func</strong> usualRecursion(n: Int) {<br>  <strong>if</strong> n &gt; 0 {<br>    usualRecursion(n: n-1)<br>  }<br>  print(n)<br>}</pre><p>Swift uses Tail Recursion Optimization, which doesn’t add a method call to the call stack in memory but jumps to the beginning of the function. It consumes significantly less stack memory.</p><p>In the previous examples, usualRecursion(n: 300000) crashes with a “Segmentation fault”, while tailRecursion(n: 1000000) is running normally.</p><p>The experiments were performed on my computer; the results for these parameters may vary on other computers.<br>You can see the optimisation in the generated assembler code.</p><p>xcrun swiftc -O -S File.swift &gt; main.asm</p><p>Even if you don’t know the assembly language, you can see it in the main.asm file that one of the ‘jamp’ command (functions starting with ‘j’) is executed for the tail recursion, while the standard callq function call command invokes the usual recursion.</p><p>Based on this optimization, we can conclude that if it is possible to recurse at the end of the function itself, then it is better to do just that.</p><h3>Storing Negative Numbers</h3><p>In many programming languages, signed numbers are stored as a set of bits, where the first bit is the sign of a number (0 is a positive number, 1 is a negative number).</p><p>The remaining bits represent the value. For example, in a type that stores 1 byte 00000001 is the number 1, 10000001 is the number -1.</p><p>But in Swift, the storage system is optimized for fast operations, and numbers are stored in a method called two’s complement. To describe a negative number in this system, you need to write this number into a bit representation, then invert the bits and add 1. For example, if this number is -15:</p><ul><li>write out the bits of decimal 15: 0001111</li><li>invert bits: 1110000</li><li>add number 1: 1110001</li><li>and, as already mentioned, at the beginning of the presentation, you need to add bit 1</li></ul><p>The final result will be 11110001.</p><p>If we want to convert the bit representation of 11110001 to decimal format, then we need to</p><ul><li>invert bits: 0001110 (we should omit the first bit as it represents the sign of the number)</li><li>add 1: 0001111</li><li>convert to decimal format: 15</li><li>and add a sign: -15</li></ul><p>This representation of numbers allows performing arithmetic operations faster at a low level.</p><pre>// The way to get inner representation of a negative number:<br>String(UInt8(bitPattern: Int8(-15)), radix: 2)</pre><h3>One function can work at a different speed</h3><p>Swift offers various collection protocols that often share the same functionality. At first glance, they work in the same way, but in reality, the operation of these functions can differ significantly depending on the protocol.</p><p>For example, the suffix function on the Sequence protocol works with O(n) complexity, while the same function on the RandomAccessCollection protocol (which inherits from Sequence; an example of a structure that conforms to this protocol is a regular Array) already works with complexity O(1). On large amounts of data, this difference will be clearly visible. Therefore, be mindful of the protocol you want to work with.</p><pre>// define an array<br><strong>let</strong> array = 0...100_000</pre><pre>print(&quot;start array suffix \(Date())&quot;)<br>// suffix(5) works O(1)<br>array.suffix(5)<br>print(&quot;end array suffix \(Date())&quot;)</pre><pre>// define a sequence<br><strong>let</strong> seq = sequence(first: 0, next: { $0 &lt; 100_000 ? $0 + 1 : <strong>nil</strong>})</pre><pre>print(&quot;start sequence suffix \(Date())&quot;)<br>// suffix(5) works O(n), iterates every element of the sequence<br>seq.suffix(5)<br>print(&quot;end sequence suffix \(Date())&quot;)</pre><h3>Collision Resolve in Dictionary</h3><p>As we know, storing elements in a Dictionary can be collisions. The hash values of different elements can match, which is a typical situation that is resolved especially (for this, the key element must implement the == operation).</p><p>A typical theoretical implementation of collision storage, which can be often heard, for example, in interviews with candidates, is when storage items are lined up in a Linked List, also called Separate Chaining.</p><p>When you search for an element by key, but the Dictionary already has other elements by hash, we will have the following situation. A typical algorithm traverses the linked list and tests for equality against elements until it encounters an equivalent one or checks all items with the same hash. This method is good and relatively simple to explain, but Swift has a different implementation in reality.</p><p>Simply speaking, all records are stored in a single array, accessed by a key hash. If a collision occurs, you should write a new element to the same array but at a certain distance from the item with which there was a collision. If this cell is also busy, check the next cell in the same distance, etc. These checks can wrap around the end of the array to the beginning of it (a logical ring). The name of the collision resolution method is Open Addressing with Linear Probing. In this solution, all items are stored in a shared space, and no additional memory is needed to keep the LinkedList running.</p><p>You can see the implementation <a href="https://github.com/apple/swift/blob/main/stdlib/public/core/Dictionary.swift">here</a>.</p><h3>Swift is Open Source</h3><p>You may not be aware, but Swift is an open-source project that you can also contribute. You can participate in implementing the standard libraries and offer your ideas that may appear in the future with new versions of Swift. Implementation of Swift’s common types you can easily find in the link <a href="https://github.com/apple/swift/tree/main/stdlib/public/core">https://github.com/apple/swift/tree/main/stdlib/public/core</a></p><p>In addition, you can develop several libraries together with the community, among which are: swift-markdown, swift-algorithms, swift-numerics, swift-collections, swift-atomics.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddfbc9268aa9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/4-lesser-known-swift-features-ddfbc9268aa9">4 Lesser-Known Swift Features</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>