<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Davmi Jose Valdez Ogando</title>
    <description>The latest articles on DEV Community by Davmi Jose Valdez Ogando (@davjvo).</description>
    <link>https://dev.to/davjvo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F194904%2F0ac2a5fe-950a-4913-a913-e93ff678a219.png</url>
      <title>DEV Community: Davmi Jose Valdez Ogando</title>
      <link>https://dev.to/davjvo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/davjvo"/>
    <language>en</language>
    <item>
      <title>100 Days of Swift - Day 11</title>
      <dc:creator>Davmi Jose Valdez Ogando</dc:creator>
      <pubDate>Fri, 15 Apr 2022 12:17:24 +0000</pubDate>
      <link>https://dev.to/davjvo/100-days-of-swift-day-11-176p</link>
      <guid>https://dev.to/davjvo/100-days-of-swift-day-11-176p</guid>
      <description>&lt;p&gt;Continuation of &lt;a href="https://www.hackingwithswift.com/"&gt;Hacking With Swift&lt;/a&gt; &lt;a href="https://www.hackingwithswift.com/100"&gt;100 Days of Swift&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Day 11 - Protocols&lt;/strong&gt;&lt;br&gt;
(Maybe just call them interfaces?)&lt;/p&gt;

&lt;p&gt;So protocols are in swift what interfaces are in any other language, but here protocols are a bit on steroids, and here is why. You have your usual stuff around them, access modifier, define the behavior of whoever implements them, you can abstract the concrete class by using the protocol in a parameter, etc. &lt;/p&gt;

&lt;p&gt;What makes them powerful is the fact that they serve sort of an abstract interface when matched with Extensions, these allow you to modify data types (structs and protocols) to add a desire behavior and at the same time when paired with protocols it helps them have a default functionality, so whenever a class implements the protocol it doesn't have to build the body of all the protocol member's (so an abstract class).&lt;/p&gt;

&lt;p&gt;Man this journey makes my brain hurts a bit.&lt;/p&gt;

</description>
      <category>swift</category>
    </item>
    <item>
      <title>100 Days of Swift - Day 10</title>
      <dc:creator>Davmi Jose Valdez Ogando</dc:creator>
      <pubDate>Fri, 15 Apr 2022 04:38:19 +0000</pubDate>
      <link>https://dev.to/davjvo/100-days-of-swift-day-10-19i0</link>
      <guid>https://dev.to/davjvo/100-days-of-swift-day-10-19i0</guid>
      <description>&lt;p&gt;Continuation of &lt;a href="https://www.hackingwithswift.com/"&gt;Hacking With Swift&lt;/a&gt; &lt;a href="https://www.hackingwithswift.com/100"&gt;100 Days of Swift&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Day 10 - Classes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Straight outta the intro we are let known the main difference between structs and classes. Classes enable inheritance in our code, and if you come from a OOP background you already know the importance of this feature.&lt;/p&gt;

&lt;p&gt;Overriding methods is done by using the &lt;code&gt;override&lt;/code&gt; keyword, and in order to avoid a class from being further extended you can always use the &lt;code&gt;final&lt;/code&gt; keyword.&lt;/p&gt;

&lt;p&gt;Another big difference is that structs are value types while classes are reference types. This means that copying the instance of a class and modifying a property results in the property value being changed on both variables, while if try the same with a struct each variable will hold a different value.&lt;/p&gt;

</description>
      <category>swift</category>
    </item>
    <item>
      <title>100 Days of Swift - Day 8 (and 9)</title>
      <dc:creator>Davmi Jose Valdez Ogando</dc:creator>
      <pubDate>Fri, 15 Apr 2022 02:59:12 +0000</pubDate>
      <link>https://dev.to/davjvo/100-days-of-swift-day-8-and-9-1fbi</link>
      <guid>https://dev.to/davjvo/100-days-of-swift-day-8-and-9-1fbi</guid>
      <description>&lt;p&gt;Continuation of &lt;a href="https://www.hackingwithswift.com/"&gt;Hacking With Swift&lt;/a&gt; &lt;a href="https://www.hackingwithswift.com/100"&gt;100 Days of Swift&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Day 8 (and 9) - Structs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In swift structs are the most commonly used data type. Almost everything is a struct from integers to strings.&lt;/p&gt;

&lt;p&gt;To declare a struct it is done like this: &lt;code&gt;struct Person { var name: String}&lt;/code&gt; and initialize it we can do it this way: &lt;code&gt;var person = Person(name: "Davmi)"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Structs the same way they contain properties, can have calculated properties, and not only that but methods and even static members too. What is more surprising is that you can even have access modifiers for structs, this makes me want to wonder what are the differences between a struct and a class?.&lt;/p&gt;

&lt;p&gt;The most important thing one can find in a struct is the observables &lt;code&gt;didSet&lt;/code&gt; and &lt;code&gt;willSet&lt;/code&gt; these 2 will trigger themselves as when either a property has changed or a property will change, in my opinion these are the best features of the language. &lt;/p&gt;

</description>
      <category>swift</category>
    </item>
    <item>
      <title>100 Days of Swift - Day 6 (and 7)</title>
      <dc:creator>Davmi Jose Valdez Ogando</dc:creator>
      <pubDate>Wed, 13 Apr 2022 00:32:23 +0000</pubDate>
      <link>https://dev.to/davjvo/100-days-of-swift-day-6-and-7-5ep1</link>
      <guid>https://dev.to/davjvo/100-days-of-swift-day-6-and-7-5ep1</guid>
      <description>&lt;p&gt;Continuation of &lt;a href="https://www.hackingwithswift.com/"&gt;Hacking With Swift&lt;/a&gt; &lt;a href="https://www.hackingwithswift.com/100"&gt;100 Days of Swift&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Day 6 (and 7) - Closures&lt;/p&gt;

&lt;p&gt;Closures are a variable containing a function to be executed, for javascript developers this is not a new topic since they do it all the time, but for .Net developers is something almost equivalent to an action. &lt;/p&gt;

&lt;p&gt;Writer note:&lt;br&gt;
Is really interesting finding the difference between these languages&lt;/p&gt;

&lt;p&gt;A closure in swift looks like this:&lt;br&gt;
`&lt;br&gt;
let myClosure = {&lt;br&gt;
     (name: String) in&lt;br&gt;
     print("This is the closure I (name) have created")&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;`&lt;/p&gt;

&lt;p&gt;Closures can get complicated, since I see how something similar to callback hell can happen. For instance this sounds complicated to read, is complicated to do and just....&lt;/p&gt;

&lt;p&gt;"A Closure that accepts a closure with a parameter as a parameter"&lt;/p&gt;

&lt;p&gt;Maybe my english is wrong, but as I am still a novice to give more notes about this, I'll just drop this &lt;a href="https://www.hackingwithswift.com/quick-start/understanding-swift/when-would-you-use-closures-with-return-values-as-parameters-to-a-function"&gt;link&lt;/a&gt; which works as a base of how powerful (and fragile) working with this type of closures can be, other use case? not sure, but I have to say that implementation of a reduce method just looks so clean.&lt;/p&gt;

</description>
      <category>swift</category>
    </item>
    <item>
      <title>100 Days of Swift - Day 5</title>
      <dc:creator>Davmi Jose Valdez Ogando</dc:creator>
      <pubDate>Tue, 12 Apr 2022 22:22:09 +0000</pubDate>
      <link>https://dev.to/davjvo/100-days-of-swift-day-5-3n6n</link>
      <guid>https://dev.to/davjvo/100-days-of-swift-day-5-3n6n</guid>
      <description>&lt;p&gt;Continuation of &lt;a href="https://www.hackingwithswift.com/"&gt;Hacking With Swift&lt;/a&gt; &lt;a href="https://www.hackingwithswift.com/100"&gt;100 Days of Swift&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Day 5 - Functions&lt;/p&gt;

&lt;p&gt;Functions are a little bit special for swift, first of all return keyword is not required, function keyword gets boiled down to func, and return statements are specified with -&amp;gt; DataType; kind of bonkers if you ask me but hey, gotta get use to it.&lt;/p&gt;

&lt;p&gt;In the other hand here we get an interesting concept, "parameter labels", these allow for a function to have an internal and external name for a passed parameter, ex:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;func greet(to name: String) -&amp;gt; String { "Hello! \(name)" }; greet(to: "Davmi");&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To get rid of the required parameter name when calling a function we can use the discard operator, the same way print() does not require the parameter to be set print(nameOfParameter: "") we can change our greet function like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;func greet(_ name: String) -&amp;gt; String { "Hello! \(name)" };&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And then the function can be called like: &lt;code&gt;greet("Davmi");&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Variadic functions are totally different, while on c# with have the &lt;code&gt;params&lt;/code&gt; keyworks, on swift we use ... after the param type, so a variadic function would be&lt;/p&gt;

&lt;p&gt;&lt;code&gt;func variadicFunc(numbers: Int...)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In swift all parameters are immutable, in order to pass by reference (modify the value of the parameter), you need to add the ampersand symbol &amp;amp;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>100 Days of Swift - Day 4</title>
      <dc:creator>Davmi Jose Valdez Ogando</dc:creator>
      <pubDate>Mon, 04 Apr 2022 00:09:32 +0000</pubDate>
      <link>https://dev.to/davjvo/100-days-of-swift-day-4-1gnm</link>
      <guid>https://dev.to/davjvo/100-days-of-swift-day-4-1gnm</guid>
      <description>&lt;p&gt;Continuation of &lt;a href="https://www.hackingwithswift.com/"&gt;Hacking With Swift&lt;/a&gt; &lt;a href="https://www.hackingwithswift.com/100"&gt;100 Days of Swift&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Day 4 - Looooooooops&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;For loops
For loops are done on a python way (maybe swift did it first?) but without the required indentation. So if you want to loop through [1,2,3,4] you'd do:
&lt;code&gt;
for number in [1,2,3,4] {
print(number)
}
&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;PS: Discard (the underscore _ ) is accepted if you don't want/need the actual variable&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;While loops&lt;br&gt;
Nothing fancy to see here&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Repeat Loops&lt;br&gt;
Basically do whiles&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Breaking and skipping in loops&lt;br&gt;
While the keyword &lt;code&gt;continue&lt;/code&gt; is just your everyday reserved word, breaks are &lt;em&gt;really&lt;/em&gt; interesting. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Swift supports something called "labeled statements". Imagine the following nested loop:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
for option1 in options {&lt;br&gt;
    for option2 in options {&lt;br&gt;
        // do code here&lt;br&gt;
    }&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Like in other languages, if we use the keyword &lt;code&gt;break&lt;/code&gt; it will exit the inner loop only, inside a function we could add a return but that's if we are inside a function, so how do we exit the parent? well you give it a label and then you tell swift to &lt;code&gt;break label_name;&lt;/code&gt; example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;outerLoop: for option1 in options {&lt;br&gt;
    for option2 in options {&lt;br&gt;
        break outerLoop;&lt;br&gt;
    }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Pretty neat in my opinion.&lt;/p&gt;

</description>
      <category>swift</category>
    </item>
    <item>
      <title>100 Days of Swift - Day 3</title>
      <dc:creator>Davmi Jose Valdez Ogando</dc:creator>
      <pubDate>Sat, 02 Apr 2022 15:11:40 +0000</pubDate>
      <link>https://dev.to/davjvo/100-days-of-swift-day-3-9b</link>
      <guid>https://dev.to/davjvo/100-days-of-swift-day-3-9b</guid>
      <description>&lt;p&gt;Continuation of &lt;a href="https://www.hackingwithswift.com/"&gt;Hacking With Swift&lt;/a&gt; &lt;a href="https://www.hackingwithswift.com/100"&gt;100 Days of Swift&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Day 3 - Operators and conditions&lt;/p&gt;

&lt;p&gt;This day was about operators, most of them (arithmetic, comparison, etc) works about the same the only difference being that parenthesis are not required inside if statements.&lt;/p&gt;

&lt;p&gt;For switch statements, &lt;code&gt;break;&lt;/code&gt; is not required / used, so if you want to execute the next condition in another case you need to use the reserved keyword &lt;code&gt;fallthrough&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now "range" operators are a bliss for numerical comparisons and array checking, the half-open range ..&amp;lt; or ..&amp;gt; implies that the range is not inclusive ex: 1..&amp;lt;5 is 1,2,3,4. Where the full range operation is inclusive so 1...5 is 1,2,3,4,5. &lt;br&gt;
On the same fashioned way one can print specifics inside an array with this operator, ex:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
let rangedArray: [Int] = [1,2,3,4];&lt;br&gt;
print(rangedArray[1...]);&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;prints:&lt;br&gt;
&lt;code&gt;[2, 3, 4]&lt;/code&gt;&lt;/p&gt;

</description>
      <category>swift</category>
    </item>
    <item>
      <title>100 Days of Swift - Day 2</title>
      <dc:creator>Davmi Jose Valdez Ogando</dc:creator>
      <pubDate>Wed, 30 Mar 2022 21:35:24 +0000</pubDate>
      <link>https://dev.to/davjvo/100-days-of-swift-day-2-32n4</link>
      <guid>https://dev.to/davjvo/100-days-of-swift-day-2-32n4</guid>
      <description>&lt;p&gt;Continuation of &lt;a href="https://www.hackingwithswift.com/"&gt;Hacking With Swift&lt;/a&gt; &lt;a href="https://www.hackingwithswift.com/100"&gt;100 Days of Swift&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Day 2 - Arrays, Dictionaries, Sets and Enums&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Arrays are a standard, type declaration is not. instead of int[] in swift we do [Int]&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sets are quite simple, just use the named reserved function Set. Have in mind that these guys are unordered, not random, just unordered.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Talking about functions, in swift you only use func nameOfFunction(property: type), as a definer, but when you call them you need to do it weirdly as nameOfFunction(property: value).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tuples like in .Net are fixed size, but have the advantage that can be named (iirc Named tuples only come later in .Net 8 or something).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dictionaries are declared like in JavaScript, which btw accessing a none existing key instead of throwing an error returns nil (null in other languages, let's not talk about undefined), if you don't want nil to show you can use dictionary["nonExistingKey", default: "fallback string"]. Lastly, for type declaration we go as [String: otherType] ex [String: Double].&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enums are declared differently, but just a bit. Inside each option of an enum you'd have to add the reserved keyword &lt;code&gt;case&lt;/code&gt;, which results in &lt;code&gt;enum Directions { case north; case south }&lt;/code&gt; and for specific values inside enums, works exactly like .Net. ALERT: the semicolon is only needed since this is an enum declared as a one liner, in a line break enum the semicolon is not required. Enums in swift can also have an associated value, where we can create something like &lt;code&gt;enum Weather { case sunny; case windy(speed: Int) }&lt;/code&gt; and we would get &lt;code&gt;windy(speed: 25)&lt;/code&gt; as a result.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Side note:&lt;br&gt;
I need to look up for swift naming standards eventually.&lt;/p&gt;

</description>
      <category>swift</category>
    </item>
    <item>
      <title>100 Days of Swift - Day 1</title>
      <dc:creator>Davmi Jose Valdez Ogando</dc:creator>
      <pubDate>Tue, 29 Mar 2022 22:47:03 +0000</pubDate>
      <link>https://dev.to/davjvo/100-days-of-swift-day-1-2a63</link>
      <guid>https://dev.to/davjvo/100-days-of-swift-day-1-2a63</guid>
      <description>&lt;p&gt;Today I started the journey on becoming an iOS native developer. Coming from 4+ years of .Net and Xamarin experience, mobile has been my passion for a while now.&lt;/p&gt;

&lt;p&gt;After some side gigs, I've finally managed to get a Mac. Therefore starting today I'll do my best to keep on a streak and follow &lt;a href="https://www.hackingwithswift.com/"&gt;Hacking With Swift&lt;/a&gt; &lt;a href="https://www.hackingwithswift.com/100"&gt;100 Days of Swift&lt;/a&gt; which has been suggested by a friend to start learning the language.&lt;/p&gt;

&lt;p&gt;Summary:&lt;/p&gt;

&lt;p&gt;Day 1 - Variables, Simple data types and string interpolation&lt;/p&gt;

&lt;p&gt;The first day as to be expected is a run down on how the language works. Declaring strings, integers, doubles and booleans.&lt;/p&gt;

&lt;p&gt;Coming from .Net the moment you see a &lt;em&gt;var&lt;/em&gt; you may immediately understand that it refers to a variable, what's a little bit shocking for JavaScript enthusiasms is the fact that &lt;em&gt;let&lt;/em&gt; is used for constants.&lt;/p&gt;

&lt;p&gt;The variable types don't have to be specified at the time you declare them, since swift is smart enough to assume the data type given the value assigned. But in case you want to add a type right after it is done like this: &lt;code&gt;let myVariable: Int = 42;&lt;/code&gt;. Semicolons are optionals unless you want to write multiple sentences in the same line (am sure I'll use them just like always).&lt;/p&gt;

&lt;p&gt;For the always useful &lt;em&gt;String Interpolation&lt;/em&gt; in swift you only need &lt;code&gt;"This is a string with some value: \(variable)"&lt;/code&gt; for it to work, nice to remember and will try not to confuse it with &lt;code&gt;"string and ${variable}"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So far so good but this are just the basics, might try to do Day 2 later too.&lt;/p&gt;

</description>
      <category>swift</category>
    </item>
  </channel>
</rss>
