Blog

Three brilliant ways to style button with SwiftUI

Sep 24, 2021

Using mobile apps, we navigate to another view, calculate business expenses, or send a tweet by tapping on a button. SwiftUI makes it a breeze to construct a button. This time we will talk how to do it in three ways using the view modifier approach, building a custom view modifier, and applying the button style.

Exploring SwiftUI map custom annotations

Aug 25, 2021

We explored the Mapview in SwiftUI a while back. This time we will look into creating custom map annotations, the limitations, and how to overcome some of them. Placing annotations on the map, like marking a specific place, is one of the most critical tasks when showing a map in our iOS applications.

How to translate SwiftUI applications

Jul 10, 2021

Localizing our applications is more critical than we think. We usually stick with English as the primary language. Only 4.9% of the world’s 7.8 billion inhabitants speak English. Most of the people aren’t native English speakers. In the grand scheme of things, only 360 million people speak English as their first language.

How to master grid layout in iOS with SwiftUI

Jun 30, 2021

Grid layouts enable us to show views in a grid that expands either vertically or horizontally. We've all seen it, for instance, in the iOS Photos application. Those who have worked with UIKit might recognize it as UICollectionView.

Cracking the Navigation Bar Secrets with SwiftUI

May 25, 2021

Navigating from one view to another, or simply showing a title and buttons, is one of the most crucial building blocks of modern iOS applications. Almost every app has this feature. SwiftUI brings some new approaches for how to show the Navigation Bar, set the title, and add buttons. So let's check it out.

The hidden secrets of TabView in iOS with SwiftUI

Apr 22, 2021

TabBar is a vital component of iOS and has been from iOS 2.0. This element appears at the bottom of the iOS and iPadOS devices and allows our app users to switch between different views or functions quickly. It is a major element of Apple's apps like Music, Podcasts, and App Store.

How to show and hide content with DisclosureGroup using SwiftUI

Mar 20, 2021

Showing and hiding some parts of information is a vital feature in mobile apps, especially considering that phone screens are much smaller than those on laptops or desktop computers. Now with the new SwiftUI capabilities, we can collapse content with DisclosureGroup. Let's see how we could use it in various ways.

How to use Alert with SwiftUI

Feb 14, 2021

Alerts are one of the most crucial building blocks of iOS applications. We can use them to inform users about an error if something takes more time, like downloading a file or ensuring that everything is OK. Another use case with alerts is asking confirmation if our app users want to delete something or make a wire transfer.

How to show text inside a circle with SwiftUI

Jan 24, 2021

This time, we will look at several ways to show a text label inside a circle using SwiftUI. We will dig deeper into three different ways using the ZStack view and .background and .overlay modifiers. As a small bonus, we will check out how to present a text label over a circle using the .clipShape modifier.

How to select images using PHPickerViewController with SwiftUI

Jan 9, 2021

Selecting images from our iPhone library is needed when changing a profile picture, posting an update, or sharing the photo of your pet. In this post, we are going to look into how to use PHPickerViewController with SwiftUI. Apple announced this view controller at WWDC2020.

Background Color with SwiftUI

Dec 27, 2020

Once you create a SwiftUI view, it has the default background color. White for light mode and black for dark mode respectively. But how to change it to something different? Let's look into that today.

How to deal with modal views (a.k.a. sheets) with SwiftUI

Nov 22, 2020

When presenting a small piece of extra information on the screen, showing a modal view is essential. With UIKit, we could do this with presentViewController:animated:completion: function. However, using SwiftUI, we need to twist our thinking towards using view or environment state, as the modal view is now called a sheet.

Launch Screen with SwiftUI

Oct 31, 2020

Launch Screen is the first interaction that users see when using our apps. That's why investing time in making our app launch screens feel responsive and visually appealing is important. We are playing with the perceived time and it can be a great first impression.

Use Custom Font with Dynamic Type in iOS apps

Sep 26, 2020

A while back we looked into dynamic type with the system font. This time we are going to check out how to use the dynamic type with a custom font in our iOS apps. Apple provides great APIs to make our apps accessible even if we're using custom font styles.

Mapview with SwiftUI

Jul 27, 2020

Finding places, navigating our way, or simply checking what's around - these are essential things that smartphones can help with. This year Apple added maps functionality to the SwiftUI framework. Let's check out how we can use it and what are the current problems.

Embracing the Dynamic Type

May 22, 2020

Every year the third Thursday of May is the Global Accessibility Awareness Day. This time I want to focus on Dynamic Type in our iOS, iPadOS, and macOS projects. By implementing font scaling we can improve lives for loads of people with disabilities and impairments.

Different flavors of WebSockets on Vapor with Swift

Apr 23, 2020

Swift on the server lately is getting more traction despite IBM leaving the club. One of the most popular frameworks out there is Vapor. It is built on top of Apple’s SwiftNIO and written fully in Swift programming language. This time we will look into how to work with WebSockets using Vapor framework. We are going to see how to create a client and server using Vapor’s module WebSocketKit and Vapor framework itself.

NSTimer vs CADisplayLink

Mar 27, 2020

NSTimer or just Timer in Swift world is a commonly used way to execute something repeatedly with an interval. For instance, a countdown timer is a perfect example. A hidden gem is CADisplayLink - a special flavor of timer that is linked to the device screen refresh rate. Usually, it is 60 frames per second, but in new iPads, it is 120 frames per second.

Clearing up after subscribing to Swift WebSockets

Feb 25, 2020

Opening and keeping a WebSocket connection alive isn't enough when dealing with it. The connection needs to be closed either from user or sever side. That is mentioned in the official WebSocket protocol.

Ignorance of the URLRequest cache

Jan 18, 2020

Caching and invalidating cache is one of the hardest things in computer science according to Martin Fowler. Recently I was dealing with cache and invalidating it in three of my applications. I had some serious issues with that and wanted to dig deeper. This time we will discuss URLRequest caching strategies and how to use it in your apps. I will share some of my learnings and problems that I found.

GraphQL Advances when fetching data in iOS with Swift and Apollo SDK

Dec 27, 2019

In previous articles, we discussed how to get started with and use subscriptions with GraphQL in iOS (and iPadOS, tvOS, and macOS) using Swift programming language.

How to use subscriptions with GraphQL using Apollo iOS SDK and Swift

Nov 26, 2019

GraphQL main functionality is to fetch and update data from the server. In addition to that subscriptions allow us to listen and to send messages from and to server in real-time. It is similar to regular queries, but the answer will be received when an event happens either on the server or on the client. Apollo iOS SDK library supports subscriptions and it is powered by the Swift WebSocket library Starscream behind the scenes to connect to the server. Let's look at how to set it up and start using it.

What is PassKit and how to use it?

Oct 20, 2019

Apple PassKit framework is responsible for Apple Pay and managing user passes in Wallet app. This time let’s talk about passes, how to create and distribute them. Wallet app allows iOS users to organize boarding passes, tickets or gifts, business and loyalty cards. In short, passes are digital representations of information that usually is printed on paper or used as plastic cards.

Dark Side of the App Store

Sep 25, 2019

I am an Apple fanboy and I admit that. But one of the most frustrating things in being an app developer is dealing with the App Store review and compliance teams. This time I would like to share my experience with these problems.

Using GraphQL in iOS with Swift

Aug 28, 2019

GraphQL is an alternative to the commonly used REST API approach. When using GraphQL you only get one single endpoint to the server and through that endpoint you need to specify the exact data you need. It was created by Facebook in 2012 and open-sourced in 2015.

Websockets in iOS 13 using Swift and Xcode 11

Jul 24, 2019

Websockets in iOS 13, macOS 10.15, tvOS 13, watchOS 6 and Mac Catalyst have gained first-class citizen status in networking stack. Apple has finally added support in URLSession and for lower level in Network.framework for their platforms. This time we will focus on implementing Websockets using URLSession capabilities.

WWDC 2019

Jun 26, 2019

This year I finally had a chance to attend WWDC (Apple Worldwide Developers Conference). It has always been my dream to go there and see the Keynote, conference and all other events with my own eyes.

UIView vs CALayer

May 3, 2019

Here's something useful to know - UIView’s are backed by CALayer’s. Layers offer a lower-level interface to the visual content. When we need more flexibility or performance, we can go to layer level.

What is (Core) Animation

Mar 27, 2019

Animation has been an important part of the Mac OS X user interface since the very beginning. You’ve probably seen the Genie effect, which occurs when you minimize an application, so many times that you hardly notice it anymore. Apple integrates animation into its operating systems and applications, and it is becoming so commonplace that users are starting to expect it. Core Animation is a group of features that makes it easy to build animated user interfaces for the Apple ecosystem devices like iPhone, iPad, Apple TV, and Mac.

Animating shapes in iOS

Feb 12, 2019

Animating a UIBezierPath drawing is a pretty trivial task. But how to animate shape morphing, i.e. make one shape change into another? (For instance, morphing a triangle into a square.) To accomplish this, we need to use CAShapeLayer and animate its properties using Core Animation capabilities.

Websockets in iOS using Swift

Jan 5, 2019

WebSockets allow for extremely fast two-way networking communication, which lets you send and receive updates quicker and more often, not to mention securely. WebSocket is a communication protocol that uses sockets, providing duplex communication over a single TCP connection. It was standardized by the IETF in 2011 and is a different protocol from HTTP.