Ship your own libraries

Hand holding an iPhone
Hand holding an iPhone
Photo by Youssef Sarhan on Unsplash

You’ve probably benefited from third-party libraries that someone else has created. Third-party libraries might save you a lot of time when building an app because they’re plug and play. Third-party libraries also have different names from dependencies.

The most common and widely used dependency manager is CocoaPods. CocoaPods has over 82,000+ libraries and counting, and is being used in over three million apps.

You can choose to create either a public or a private third-party library. A public library can used by others who could then suggest improvements to your code. …


Leverage UIBezierPath to draw awesome shapes in iOS apps

Multi-colored circles
Multi-colored circles
Photo by Mel Poole on Unsplash.

There are many different libraries out there that can help you create either a full circle, half-circle, or even a pizza slice shape.

But what if the process of making it wasn’t so difficult? Would you still consider using a third-party SDK? The benefit of making your own is the flexibility to make whatever you want.

Sometimes, third-party SDKs just don’t offer what you need and you have to continue your search for another one. That’s a lot of time wasted if it doesn’t fit into your business requirements.

Well, I hope this one will give you what you need.

Prerequisites


Leverage the vast library of system images

A smartphone homescreen, displaying a number of apps.
A smartphone homescreen, displaying a number of apps.
Photo by David Grandmougin on Unsplash

SF Symbols is a Mac app that contains over 2,400 icons as of 2021 that can be used in your own iOS project. I believe the number will continue to increase as time goes by.

Let’s be honest: We all have that moment when we struggle to find a certain icon for our app. When we start googling for that icon, we run into some problems like:

  • The icon isn’t available in the size you want
  • The icon needs to be credited
  • The icon needs to be paid for

And the list goes on and on.

Apple introduced SF Symbols…


If you love extensions, this is for you. If not, I’ll change your mind

Image of all-in-one desktop.
Image of all-in-one desktop.
Photo by PolaroMagnet on Unsplash

Why Do We Need Extensions?

You need extensions because they save you time from re-creating the same thing over and over again. Don’t you find it tiring sometimes that you have to type it over and over again?

In my opinion, using an extension is almost equivalent to working hard and working smart at the same time. Let that sink in a little bit and you will appreciate the use of extensions.

Extensions is like a module component on your project that can be moved from one project to another project. So, if it makes your life easier, why not use them?

I’ve built multiple…


Animating our UI when the value of the segmented control changes

Players on a soccer pitch
Players on a soccer pitch
Photo by Markus Spiske on Unsplash.

There isn’t a fully segmented control view where you can scroll the entire view from one segment to another segment, which is a bummer. But that is totally fine because you can achieve almost anything with SwiftUI.

Today, we will create a fully segmented scrolling effect.

Stacks

  • Xcode 12.3
  • SwiftUI

Prerequisites

To follow along with this tutorial, you’ll need some basic knowledge in:

  • Swift
  • At least Xcode 11

Setting Up the Segmented Control

You will create a state to keep the value of the selected segmented control:

@State private var currentSegment = 0

You will embed everything within the VStack and use SegmentedPickerStyle for the picker style:


How SOLID applies to the iOS and Swift worlds

A color-blocked background with the word SOLID in the foreground.
A color-blocked background with the word SOLID in the foreground.
Image credit: Author

SOLID is made up of five design principles meant to make code more understandable, flexible, and maintainable. The principle first appeared in a 2000 paper called “Design Principles and Design Patterns” by Robert Martin, but the acronym SOLID was introduced by Michael Feathers, according to Wikipedia.

I hope when you land yourself on this article, you have the desire to actually want to become a better engineer or write better code. When engineers write code, we should think about the scalability of the code and if the code is readable by different engineers. …


Build beautiful animations that repeat in your apps

Phone over a blue backdrop
Phone over a blue backdrop
Photo by Al Hakiim on Unsplash.

With so much more support provided by Apple, animation in SwiftUI is a lot easier to achieve than in UIKit. I wonder if this will be a good or bad thing. Regardless, we need to make use of what is provided, right?

In this tutorial, you’ll learn how to perform a repeat animation in SwiftUI.

A repeat animation is basically an animation that repeats over and over again. Pretty self-explanatory. You can imagine it as having the same behaviour as a GIF that keeps repeating.

Prerequisites

To follow along with this tutorial, you’ll need some basic knowledge in:

  • Swift
  • At least…


Change tabs in your app with style

Two phone screens
Two phone screens
Photo by Charles Deluvio on Unsplash.

At the recent WWDC 2020, Apple introduced an additional style for TabView called PageTabViewStyle. This is equivalent to Horizontal Paging Scroll, which is commonly used for the onboarding screen.

“A TabViewStyle that implements a paged scrolling TabView.” — Apple Documentation

Prerequisites

To follow along with this tutorial, you’ll need some basic knowledge in:

  • Swift
  • At least Xcode 12+

Note: This only supports iOS 14+.

Getting Started With PageTabViewStyle

Let’s quickly set up four tabs on the TabView with the capabilities of showing a filled image when selected and an unfilled image when unselected.

To have that, you will need to have a state to know…


Give your users the ability to set colors in your app in a whole new way

Photo by Robert Katzki on Unsplash

In the recent WWDC 2020, Apple introduced ColorPicker, where you’ll be able to let the user pick a color.

This will probably be very useful if your app allow users to pick a color — for either the text, background, or so on. Other than that, I still can’t think of why you’d need to implement this.

Prerequisites

To follow along with this tutorial, you’ll need some basic knowledge in:

  • A basic familiarity with Swift
  • At least Xcode 12+
  • Only supports iOS 14+

Getting Started With ColorPicker

To begin, you’ll first need to have a State created, where you can store the value of the…


At WWDC 2020, Apple introduced a view that can play local videos or videos from a URL

Arm holding out a camera.
Arm holding out a camera.
Photo by Thomas William on Unsplash.

Disclaimer: You won’t be able to use videos from YouTube.

“A view that displays the video content from a player object along with system-supplied playback controls.” — Apple Developer

Prerequisites

To follow along with this tutorial, you’ll need some basic knowledge in:

  • Swift
  • At least Xcode 12+

Note: This only supports iOS 14+.

Getting Started With VideoPlayer

To begin, you will first need to import the required module:

import AVKit

For the purpose of illustration, I will download the Nyan Cat video from YouTube, which will have an mp4 extension. The file will then be placed inside the project as shown below. …

Kelvin Tan

I write about SwiftUI, UIKit, Swift, RxSwift at www.daddycoding.com.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store