WTF is an Extension ?

Have you every want to modify your car ? Well if you have then you already know the basics of what a extension is. Since you modify something that someone else has made (maybe you also made it too, but thats okay).

OR have you ever been in a situation where, you are working on something. And you thought “maybe I should write a new class to extend this other class, that way I add to the functionality”. You could do that, “could” being the keyword there. OR you could just use Extentions 🙂

Extensions let you add new functionality to existing classes, structs, enumerations, or protocols. All you have to do is extended them.

WTF is a closure ?  (Swift)

Your going about your normal programming life. Everything is fine, your using functions and classes and variables, and etc. And you’ll be thinking “I got this programming thing pretty much in the bag”

But then you see “it” what “it” is your not sure. Its something coming out the side of your function … OMG is looks like another function. A function against a function ???

We all know what a function is, it is just piece of code that we can use in different places. It some times takes in varables and spits them out. This is all “normal”, however what if I told you that you could return a function from a function ? Or even add a function as a input value ? Pretty crazy right ?

Some of you out there might be thinking, “why would you need this ? stop making things soo complicated !” Well if you want your applications to run asynchronously, your gonna wanna use closures when ever you do something that takes alot of time.

So the use case would go something like this:You wanna log someone in, and execute something else as soon as it finishs, without freezing up the UI (in a iOS app).

Instead of doing it the standard way of writing the code that needs to be executed right after the method call. You can just pass the login function, another function to execute once done.

The in depth code will come in part two.

Hope you found the theory behind it easy to understand 😅

My History with Cell Phones

The first smart phone I ever got was a android. It was a small thick brick from HTC, that did everything that I could ever want. Then after awhile I decided to switch carriers, which lead me to experience one of the first windows phones, it was a Nokia Lumia 920. And after that I moved on to a number of different BLU phones. The BLU phones that I bought were nice, but I kept up grading every 8 months to half a year.

As you can see I am a pretty fickle person, I am always looking for the next cool new thing. And last year I spent the most I had ever spent on a phone up until that point, and bought a Asus Zen Phone. It was the best android phone I had ever had in my life. It was super fast, responsive, reliable, and had great battery life.

Things were going well with the phone for a while there, and for a reason I can’t remember to this day I ordered an iPhone.  I bought a used 6s which I kept for a few weeks, until I realized that I needed more storage. At which point I returned it and bought another 6s with more storage. And then I realized the battery life wasn’t good enough for me. So I went ahead and dropped 1300 dollars on a brand new iPhone 7 Plus with 128 GB of storage.

I am not sure why I bought a iPhone. I think its because I wanted to make apps for it, and wanted that brand name 🤩 After having it for a few months I found the experience to be very very alright, nothing insanely special. I still have the iPhone and don’t plan to upgrade it for a long long long time.

I kinda regretted buying it for a few months until I started to mess with iOS’s new features, ML and AR. Both of which are interesting to play with, but as you can see from the app store it not like every other app out there has AR or ML in it.

WTF is a Protocol ?

This part of the Swift language is pretty simple to explain. A “Protocol” is what is called a “Interface” in most of the other languages out there. It is basically a set of rules that your struct, class, or enum has to conform to.

You maybe asking your self “why would I ever need this weird construct ? I know whats what. I don’t need these things if I am doing it all myself. ” Well thing is that it keeps you honest, and it keeps you on track.

More importantly it opens the door to things like delegates. More on this in my next blog post.

Going from Apple fanboy to hater to fanboy again

When I was kid just going to primary school, I never knew what a computer was, how it worked, or what it could do. My family had a computer at home but it was just a big grey box to me. It just sat on a desk.

However on my first day of school we had time with computers, we had this really great computer lab full of macs, and we had carts full of mac laptops. They looked cool, and you could do a lot with them. Even when being a 6 year old kid, I could appreciate the design and work that went into them. It felt like someone put in a lot of time to just make sure everything was perfect.

So after using them for awhile, I asked my dad if we could get one. I went into full sales pitch mode, and told him about all the cool things that it could do, and how well it was designed. However being new immigrates to Canada, that computer was out of our price range, and he said to just use the one we already had. My dads response was, “Why don’t you use the computer we already have ?”. And that computer was a Comqa running Windows 95. The experience of using that machine made me into an even bigger Apple fan.

As the years passed and I got to high school I still hadn’t owned an apple product, and started to rationalize why I didn’t have an apple product. I chalked it up to the good old Marxist ideas of the “haves” and the “have nots”. I was a “have not”. So my views on Apple changed from a being “Its such a cool company that makes awesome products” to “They make play things for idiots that choose to buy it”

That ideology lasted for a pretty long time, till I started making money. A year after my first internship I had quite a bit cash saved up even after paying for university. So in my second to last year (or what I had thought to be my second to last year), I called my bank, raised my credit limit, and bought a bueatiful 2016 13′ MacBook Pro. And I was a fan again 🙂, to long had I been using a windows machine.

What most people don’t realize is that Apple really cares about two things, build quality, and the little things. That laptop felt like a heavy solid chunk of metal, that just happened to be a laptop. The build quality was insanely good.

When a person pays a crazy sum of money for a fairly basic computer, most people are would say it’s dumb to do so. Others would say maybe he or she is just that rich. Most people equate value with quantity. However in Apples case, it’s build quality, and effort put into places you wouldn’t even think of.

And that right there is what Apple is unapologetically all about.