Over the past year, SwiftUI has gotten more robust and mature than it was just a couple of years ago. However, there are still quite a few UIKit elements missing in SwiftUI — and one of them is the UIFontPickerViewController
. This UIKit class is a subclass of UIViewController
and is used to allow the users to pick a font that is preinstalled on their device. This allows a whole new dimension of customizability and is something that I am working on with the new update of Sticker Cards.
In this tutorial, we’ll build a simple bridge that brings this powerful…
Swift 5.1 introduces a new property concept called property wrapper. A property wrapper helps you mark a clear distinction between the code that defines a property and the code that manages how that property is stored. For example, a common task that we as iOS developers face regularly is persisting data in the UserDefaults store. In this tutorial, we’ll learn how to handle reading and writing data from and to UserDeafaults. This can be streamlined and the distinction mentioned above can be created by using a property wrapper.
Let us get started by creating a struct and by defining a…
This article was originally published on my website
According to the Swift Org Docs:
Generic code enables you to write flexible, reusable functions and types that can work with any type, subject to requirements that you define. You can write code that avoids duplication and expresses its intent in a clear, abstracted manner.
In this article, we’ll learn about generics by writing and optimizing a maximumOfTwo function. This function will be used to first get the maximum between two integers but later in this article, you’ll learn how to convert this function into a generic so that this function will…
In this tutorial, we’ll learn how to use the IGStoryKit framework to share stickers with customized background to Instagram Stories.
IGStoryKit
lets you easily share content stickers with different background types to Instagram stories from your iOS and iPadOS apps.
IGStoryKit
is available via Swift Package Manager. To add IGStoryKit
simply add this repo’s URL to your project’s package file.
https://github.com/SwapnanilDhol/IGStoryKit
To follow along with this tutorial, you’ll need some basic knowledge of the Swift Programming Language. You’ll also need Xcode versions supporting iOS 11 and above.
Before we start configuring and posting to Instagram stories, we’ll need to create…
This article was originally published on my website.
In this tutorial, we’ll learn how to deal with Optionals in Swift.
Optionals are Swift Language traits that lets the programmer operate on a variable that may or may not have a value at a particular instance. Usually, this applies to async tasks such as Networking: When you make a request to a server for, say, a list of cat pictures the data in the variable will take some time to arrive. During this loading time if you’d try to access the value within this variable you will crash the application since…
At WWDC 2020 SwiftUI got a new property wrapper called @StateObject
. What is the main purpose and why does this new property wrapper exist?
Previously when views subscribed to Data models, they did so with the @ObservedObject
property wrapper. This was fine, however there was a critical issue. @ObservedObject
is not owned by the view. It is not considered to be the view’s ultimate source of truth. The variable attached to the said property wrapper is not in control/dependent on the view’s lifecycle. This caused an error especially when a view would instantiate its body property before the @ObservedObject
property…
This tutorial was first published on my blog.
At WWDC 2020, Apple announced various improvements to their frameworks and SwiftUI was at the front of the line to receive new API and existing API refinements. In this tutorial, we’ll learn how crazy simple it is to integrate MapViews using the MapKit framework, which is now native, in your SwiftUI Applications. Let’s go
Please note that this tutorial requires you to have Xcode 12 but doesn’t require that you have macOS Big Sur installed in your machine.
The first thing we have to do is to import MapKit
in your current…
This article was originally published on my blog.
At WWDC 2020 Apple announced a whole new set of interactions with the existing UIMenu and UIAction APIs. The small menus that were previously triggered by haptic/3D Touch can now be shown without them. Here’s how
This tutorial requires that you have Xcode 12 installed
Let’s make a simple UIKit app. I’ll be using storyboards in this tutorial as it’s simpler for what we’re going to do here. Make sure to embed your ViewController in a NavigationController so that we can access the navigationItems property on the Navigation Bar. …
This post was originally published on my blog
WWDC 2020 brought many new UIControl APIs to iOS, iPadOS, and macOS. One of the best new additions is the system Color Picker. Here are some of the main features of this new control-
The first…
At WWDC 2019 Apple announced that it’ll now be possible to port iOS apps to the Mac via a technology called Catalyst and ever since I’ve had a goal to bring an existing app of mine to the Mac App Store just to see what the process would look like.
I’ve been working on making my Color and Gradient maker, analyzer and editor app called Neon work on the Mac and even though I use storyboards, I don’t use segues and so it is important that I know when the View Controller needs to be presented by pushing it onto…