Xcode 12 — iOS14

In this tutorial, We will be implementing logic to make text with Subscripts and Superscripts.

To implement subscript/superscripts first we need to define a logic to understand what part of text will be carried as sub/super scripts.

1. Any text in ^{} will be treated as superscript.
e.g. => X^{2} -> X²
2. Any text in _{} will be treated as subscript.
e.g. => H_{2} => H₂
var text = Text("pre") + Text("post")//Also
text = text + Text("more text")
Text("X").font(.callout) + Text(2).font(.caption).baselineOffset(6.0)Output => X²

Logic to implement:

1. Iterate throw String for find…

SwiftUI: Fixing keyboard issues, while creating forms [iOS 14- XCode 12]

In this tutorial, we are going to implement custom TextField. This TextField will have capabilities to pass Keyboard focus. Along with this, we will also enable interactive keyboard dismissal to create better UX for views with multiple TextField like forms.

Let’s divide the problem into smaller subtasks and solve them one by one.

  1. Wrap UIKit’s UITextField using UIViewRepresentable
  2. Enable this new TextField to pass keyboard using cross binding
  3. Add Toolbar for numeric keyboard as they do not have next button inbuild
  4. Use Introspect to enable interactive keyboard dismissal.

UIKit’s UITextField using UIViewRepresentable:

Create simple UIViewRepresentable with all required parameters like placeholder, text binding, keyboard…

Xcode 12.4 — iOS 14

In this tutorial, We are going to implement custom swipe action in list cell.

We will be using LazyVStack with ScrollView. It is more customisable compare to list.

We are going to divide this problem into following segments

  1. Create Simple List View with or without header.
  2. Create Custom Action Buttons.
  3. Create a view modifier. This view modifier will be used to listen swipe gesture
  4. On swipe direction, show/hide relevant buttons
  5. Add View extension utility so that we can easily use view modifier.

Simple List View:

We create a custom cell, Which shows cell index. Create a LazyVStack bind…

XCode 12 — iOS 14

In this tutorial, We are going to implement CrossDissolve slide animation for Tab bar view.

We cannot achieve CrossDissolve animation in SwiftUI itself, unless we create custom tab bar. In this tutorial, We are going to implement crossDissolve for native Tab-bar.

As Tabbar does not give any API to add custom animation, We are going to inspect Tab-bar for UIKit’s UITabbar. After getting UITabbar, we implement the animation.

To get UITabbar using following library.

import SwiftUI
import Introspect //To Get UIView in view hierarchy
LoopingVideoApp: App {
var body: some Scene {…

Flow chart for various app architecture

Xcode 12 — iOS 14

In this tutorial, We will be converting ScrollView’s content into a UIImage.
First, we will convert any view into the UIImage then we will extend the same logic to screenshot the entire Scroll view content.

  1. Create an extension on SwiftUI’s view, which takes the position of part of the view we need to convert into an image. We will create a dummy UIHostingViewController with the given frame. From UIHostingView controller, we will access UIKit’s view.
extension View {    
func takeScreenshot(origin: CGPoint, size: CGSize) -> UIImage {…

Source: Bloomberg

In-App purchase is one of the most convenient payment method for iOS Apps but Apple’s 30% cut takes out big Chunk. The Apple policy force virtual goods to be purchased only via Apple’s in-app purchase. When I use to work with a gaming company, I understand some work around to bypass this.

1. Adding physical goods with virtual one: For larger amount of In app purchase, add a physical good with it like T-shirt and create separate segment for it. And in this segment you can add credit cards etc. …

Various methods to store/read data in iOS App

In this tutorial, We are going to learn ways to read, write, store data.


A simple understanding is the resource file package, which will organize many pictures, xibs, and text files together and package them into a Bundle file. A main bundle get packaged with App. There can be separate bundle for individual library used in app.

//Access the main bundlelet bundle = Bundle.main
let jsonFile = Bundle.main.path(forResource: “xxx”, ofType: “json”)


In a Non-Rooted iPhone/iPad device, An App can only perform file operations in the file…

Multiline Text field Xocde 12 — iOS 14 [iOS 13 support here]

When using default Swift 2.0 TextEditor. There is no direct way to add palce holder. Even setting background color, changing text cursor color is not straight forward. In this tutorial we are going to implement all the basic text editor functionality missing in TextEditor.

Setting Placeholder, to set placeholder we are going to create a custom TextEditor view. This text editor will be wrapped by Zstack. This ZStack will also contain placeholder text label with will be visible if no text has been added to the TextEditor

struct CustomTextEditor: View {
let placeholder: String
@Binding var

Pull down to refresh data in SwiftUI — Xcode 12-iOS 14

In this tutorial, We are going to implement Pull to refresh using only SwiftUI components.

We are going to divide this problem in two parts:

  1. Logic to detect if user pull down the scroll view
  2. Add Progress view and pull down loader animations

Prafulla Singh

iOS Developer | Swift | Flutter

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