I always preferred using terminal over GUI apps to control my projects or to navigate through folders on my disk. I admit this is not really the most intuitive and friendly approach but one thing is for sure: once you get used to this you’ll want to use terminal for pretty much anything possible.
The touch command creates new, empty files. It is also used to change the timestamps (i.e., dates and times of the most recent access and modification) on existing files and directories.
touch empty_file.txt
The mkdir command allows the user to create directories (also referred to as…
In order to gain users, localizing our apps is essential since not everyone speaks the same language. Even if our app uses english strings, only a relatively thin slice of the entire global population understands it. We don’t want to lose the larger slice of the users, do we?
There are quite easy and quick ways to localize ours apps using external dependencies such as Applanga or Lokalise. I used both of them in the past, and I can vouch for them if you’re working on a enterprise level. They’re great but they’re a business and as any other: they…
It’s been a while we know it's possible to do snapshot testing on iOS. Recently, my friend Dariusz Rybicki introduced me to SnapshotTesting (from Stephen Celis and Brandon Williams ) and that’s what we’ll talk about today.
Let’s start by adding the following swift package:
https://github.com/pointfreeco/swift-snapshot-testing
Then, let’s create a simple screen and set view.backgroundColor
to red:
In our unit test target, let’s create a test class, import SnapshotTesting
and create a test case for this screen:
Right now, if we run the tests we’ll see an error saying that no reference was found on disk. This happens because…
Back in 2017, I watched Eric Cerney at the RWDevCon talking about MVVM and data bindings. What’s cool about it, is that it does the same thing that an observable would do in Rx with much less code.
By overriding setters we can simulate observables. Skipping the MVVM refactoring, the most interesting thing here is Boxing. A technique where we wrap an object with generic type T and everytime its value gets updated a closure returns it.
This is great because it leaves our view controller completely isolated from our logic. It does exactly what a view controller should…
In the last couple of days I’ve been working on a QR code scanner feature (as you can probably tell by the topic of my last article) and I’ve stumbled upon a situation where I needed a semi-transparent overlay view which is completely transparent in the middle. In other words: a squared hole into an opaque view (or in this case semi-opaque).
In this pandemic you have probably seen many restaurants using QR codes for their menu in order to avoid using carton-made menu that could possibly be contaminated by other customers. Today I’ll quickly go through how to use QR (quick-response) codes and even regular barcodes in Swift.
To generate QR codes or barcodes we need CoreImage framework which is used to generate images and apply filters but we will be fine by just importing UIKit instead.
A weird thing about using CoreImage filters is that they are initialized with a string from the generator protocol you want to use. …
Today we’ll go over how to use dependency injection with Swift 5.1 property wrappers. This approach is particularly interesting because its clean and very lightweight since it doesn’t require any third-party library.
When using property wrappers, we need to declare the wrappedValue
. In the initializer we are resolving the dependency which will bring us the instance that was stored in the container for that type.
The container holds a private static variable which will be used on static functions such as resolve and register and it also holds a private dictionary for the dependencies. …
Today we’ll implement a custom transition, scaling an UIView
from half-screen up to fullscreen using UIViewControllerAnimatedTransitioning
. What will happen inside this custom transition is just some simple constraint animation but we could do pretty much anything.
In this article, we will cover the basics of Dependency Injection and how to apply it to an iOS project using an open-source framework called Swinject.
Dependency Injection (DI) is a technique in which you set the dependencies of an entity from outside of its own scope, turning your system into loosely coupled modules. Imagine a class holding references to every other component of the app saving you from communication patterns between UIViewControllers for example.
In 2002, a sci-fi movie named Minority Report showed us a range of futuristic tech concepts, and for many geeks and enthusiasts (like me), it created an excitement to reach the point where these big tech ideas could become reality.
This movie takes place in the year 2054. One of the most iconic scenes for me is when Jon [Tom Cruise] controls holograms according to his gestures and the movement of his fingers.
The GIF was removed 😢
Before we start trying to reproduce this scene, here’s a bit of bad news:
iOS Engineer @elixxir_io