With the new concurrency-related changes that are coming up with Swift 5.5, the language is making it even easier for us Swift devs to write concurrent code. There is a massive set of proposals that have been accepted into the 5.5 release, and there’s already a ton of new stuff being put out for us to learn and get accustomed to.
One of the new features that is going to come up in the new Swift release is the availability of a new primitive called the
Ever wondered how a method call in Swift works? Seems pretty simple that you define methods and somehow magically during runtime, the method calls work even though there are so many things to take care of, like overridden methods due to inheritance, method call optimizations, etc.
In this short article, we’ll look at the different types of method dispatches available in Swift. While discussing the dispatches, we’ll also discuss the few optimizations both the compiler and runtime make in order to actually process a method call.
So let’s go ahead and dive in.
Method dispatches are processes by which function…
Nowadays, mobile devices come with a lot of powerful CPUs at their disposal. This gives you the ability to make apps that are highly performant. Imagine your app is an image gallery app where you have to build a slick UI with which the user can interact while simultaneously uploading and downloading their 25MB HD images.
You would never want your app to stop responding to the user’s touches while the images are being uploaded or downloaded (and vice versa). Therefore, in order to make sure that you do not end up in this scenario, you need to make sure…
Every time you search for a mobile system design resource on the internet, you’re bombarded with lots of articles. But alas, once you open them, you find out that they’re just a sham. They turn out to be articles related to backend system design instead of mobile system design.
The lack of mobile-specific system design articles is just astounding!
In this article, I will try to tackle the general problems that you might face in a mobile system design interview. I will try to cover as much ground as possible in this article.
This article is not a writeup on…
I guess you're right, but I think it would depend on the size of the struct you're declaring. As far as I think how it works is that:
1. Structs whose size cannot be determined at compile time due to protocol or generic type associations are allocated on the heap.
2. Structs that might take up space more than that of a stack will have to reside in the heap.
Hope this helps! Lemme know if you find something as well 'cause I'm still searching as too !
EDIT — Found this talk — https://developer.apple.com/videos/play/wwdc2016/416/ which explains how protocols works. A must watch to understand memory implications of structs which implement a protocol.
I’ve been asked this question many times during interviews: “What is a class and what is a struct? Mention a few differences and when you would use them.”
So I thought I would tackle this topic starting from the very basics and move on to each of their niche properties.
At a very high level, structs and classes can be thought of as constructs that are used to hold values (variables and constants) and functions. …
By and large, functions are a basic component of any programming language and is one of the first things that you learn when you start to code as well. In this article we’ll go through the basics and then also delve into some of their details.
Functions and Closures are both constructs provided by Swift to perform a set of tasks within itself. They take in 0 or more parameters which might be needed to performs the tasks and they can optionally return a value.
Let’s start with functions, since they’re easier to understand.
There are five parts to a…
Automatic Reference Counting (ARC) is a memory-management solution that makes sure the memory for the different objects and functions you create are properly allocated and deallocated so the device on which your code runs doesn’t run out of memory.
In order to understand ARC better, let’s give this discussion a little structure by understanding what we as programmers do.
We define variables and functions when we write code. These variables and functions need to be stored in the device’s memory so we can use them and they get removed from the memory once we don’t need them anymore — or…
I’m sure all of us would have felt the need to re-engage our users with the app that we’ve built with all that love. All we need is a way to remind our users that your app can help them with the problems that they are facing! Now how do we do that??
Recently I was figuring out ways to solve this problem of re-engagement when I came across iOS Search APIs. All I knew was that you could index your content on Spotlight but I never took it so seriously, but the more I started reading about it, the…
React Native — the prodigal son for all mobile development! For a long while now I had been putting off my encounter with React Native just because of all the horror stories surrounding it. In the past few months I’ve been using it I formed a few opinions of my own regarding the SDK (remember these are just opinions and need to be taken with a pinch of salt and pepper and probably some marination.). In this article I would like to share these opinions and also help all you people out there who would want to integrate React Native…
Guy who handles everything mobile @headout among other things! Ex @practo