In the latest WWDC 2021, Apple has introduced in Swift 5.5 in SE-0296 the async / await pattern. This pattern allow to run async asynchronous code as it were synchronous. And of course this is a great feature for the language, because as developers we can take advantage of this and improve our code bases.
Async programming with explicit callbacks (also called completion handlers) has many problems. We propose to address these problems by introducing async functions into the language. Async functions allow asynchronous code to be written as straight-line code. …
Writing tests for your UI views is so important as unit and integration tests. These kinds of tests are not mandatory but are helpful while developing your iOS application. Today I want to share with you how to add snapshot tests using
iOSSnapshotTestCase framework and how to add support for dark mode.
This kind of test consists in taking a snapshot from your view and compare with reference images that are stored in our project. Of course to have a reference image we need first to capture this image.
Snapshot tests should only used to validate the view, not logic…
Sometimes we need to simulate a poor connection or no connection in our iOS simulator. One way to do this is disabling our WiFi from our Mac or device, but what about simulating a 3G, LTE, DSL, edge, etc connection?
In this post, I want to share with you some options to do this in both an iOS simulator and a real device.
To simulate different kind of networks as LTE, 3G, DSL, etc, we need to download the Network Link Conditioner tool. Look for your Xcode version and install it.
After download the .dmg …
Memory management is a topic that every time we write code, it needs to be handled. Fortunately Swift helps us with the Automatic Reference Counting (ARC). But human errors are still there and as we saw in the last entry one common mistake we commit is Retain Cycles.
A retain cycle is generated when an Object A retains another Object B and Object B retains Object A. Let’s see an example:
Suppose we have two objects
Child, and create two references to it.
Notice that both variables are optional and then we assign their properties to the…
In this post we talk about the
Proxy design pattern and a simple example how to use it, in this case, in iOS applications to prevent retain cycles in an effective and clean way.
As defined in the book Design Patterns by Gamma, Johnson, Vlissides, Helm and collaborators, the proxy design pattern is defined:
Provide a surrogate or placeholder for another object to control access to it. It makes consumers believe they’re talking to the real implementation.
And its diagram looks like this:
Diagram from Wikipedia
If this is the first time that you hear about this design pattern, it…
En la entrada de hoy hablaremos:
Este término seguramente ya lo has escuchado antes, y es que no está limitado solo a cuando estamos desarrollando aplicaciones en iOS. Un Memory Leak (o en español un “Fuga de memoria”) sucede cuando un espacio en memoria no se pudo liberar.
Sin embargo, aún cuando sabemos que se deben evitar, nos hemos encontrado en algunos casos en que la aplicación empieza a consumir más memoria de lo que debería, a veces algunos…
Sometimes we need to change the default User model in our Laravel Application. So let’s get started with this tutorial.
First, we need to create a simple Laravel Application using the installer with composer. We can do it easily using the “laravel new auth_model_example” command.
Once our application is ready, we’ll open the current project using our favorite editor, in this case I’ll use Atom editor, you can get it here.
Changing the Users migration:
Go ahead and open the Users migration in auth_model_example/database/migrations/2014_10_12_000000_create_users_table.php file and we’ll rename it to “2014_10_12_000000_create_administrators_table.php”, for example.
Rename all the “Users” words to “Administrators”…
Software Engineer with experience in mobile development using mainly agile methodologies. Experience with all Apple ecosystem.