For most of my projects, I get the app designs from my clients. And if I need to say what the most used design elements have been in 2020, I’d say that they’ve been flat elements, blurs, and shadows. There’s no problem with flat elements, as the native iOS design is pretty flat. So let’s see how to add blurry backgrounds and shadows to your iOS apps.
First, let’s create a blurry rectangle and a rectangle with a shadow in your iOS app. …
Once I got a rather simple-looking task from a regular client of mine: he needed to make a screen for an iOS app with several switches. The switch was long and thin. It was different from both the UISwitch, which has size 51x31 points, and the Material switch, which is more flexible in size, but the thumb is bigger than the track.
I found many solutions on GitHub, but they were either modifications of existing UISwitch, or variations of Material switch. Other options didn’t look like switches at all.
I’ll give some references, in case you’re looking for something different:
Back in 1936 the computer scientist Alan Turing invented a model of a computational device later known as The Turing Machine. This machine did simple operations and had a state. This state was actually a piece of data, and the machine was “running” algorithms to perform operations over that data.
“Algorithms + Data Structures = Programs”
— Niklaus Wirth, 1976
All that a computer program does is actually just data receiving, sending and processing. Data is that unit with which our code works. …
During my career as an iOS developer I wrote around 50 apps. Some of them were small and stayed in the stores just for several months, others stayed alive and got regular updates for years. I’m not a designer myself, I get designs from my clients or a third-party designer. And almost all designs I saw included custom back button on most screens.
Using iOS storyboards to develop UIs, I tried to find an easy way for the user to return to a previous screen, some kind of backward segue. …
Showing even simple pop-up dialogs requires several lines of code in Swift. When you have data validation or proper error handling, you have tens or even hundreds of places where you can show a pop-up. Let’s write several
UIViewController extensions that’ll do the work for us.
self.show(message: "Let's start!")
The first two extensions will show simple pop-ups with only one button. The difference will be only in the title. You can add some styling, but Apple doesn’t usually motivate developers to customise pop-up windows, so I’ll use the basic
As you can see, the title is predefined and can’t be changed, but it can be translated depending on the system locale. If you have files with localisations, you can do it this…
When you write mobile apps in Swift, you usually have a lot of background work. I’ve been working as a mobile developer for almost 10 years and I can hardly remember a single project without Internet requests. Each Internet request requires time to be processed. Usually an unknown amount of time, possibly, endless.
If you do such work in the main or UI (which is the same) thread, your UI will get stuck. That’s why asynchronous tasks in Swift are designed the way they will never do so. The most common way is to avoid it is to use a callback or delegate. …
Emoji have become a big part of our life. iPhones and iPads have a special emoji keyboard (unless it’s turned off). We see them on websites, in mobile and desktop apps, and we enter them when writing texts and filling in forms.
How do we control them? How do we prevent users from entering emoji in
UITextField? How do we parse emoji in the JSON response from a server? Let’s discuss it all.
Emoji are a part of modern Unicode. Computers work with bits and bytes — not with smiles and other small pictures. Letters, numbers, and special characters in a text are all encoded in one or more bytes each. The same goes for emoji. …
If you start developing a new iOS app, you probably need to use several external libraries. Even if it’s going to be a very simple one, you probably want to gather some statistics, make requests or show a loading indicator. All of this can be done without external libraries. After all, external libraries are also code, and you can write the code yourself. But why would you do something from scratch if someone else has spent months or years doing so and they are ready to give it to you for free?
The most popular dependency manager for iOS is
Cocoapods. It downloads the libraries you need and their dependencies. It’s very easy to integrate and it has the biggest collection of libraries for iOS. In fact,
Cocoapods is a standard dependency manager. …
I’m a mobile developer, and one of the reasons I switched to Kotlin immediately after it appeared is because of its support of extensions. Extensions allow you to add methods to any existing class, even to
Any or an optional type (for example,
If you extend a base class, all derived classes automatically get this extension. You can also override methods from extensions, which makes this mechanism even more flexible and powerful.
I use Kotlin 1.4.0 for Android in Android Studio 4.0.1. And I assume that all methods will be called from Kotlin, not Java. …
Optional variables are an important concept in Swift. In older languages, like C++ or Java, all pointers are optional, but all basic types are not — unless they’re wrapped in some structure.
Internally, optional is a structure which has two variables:
If the flag is false, the value is ignored. If the flag is true, the value can be used.
Logically, it can be represented as a box, which can have some content inside or have nothing at all.
An advantage of Swift is that optionals are integrated into the language itself. The compiler will show a compile-time error if you’re doing something wrong. But there are exceptions. Here I’ll try to review how to use optionals without errors and how not to use them. …