Reducing Code Duplication in Swift using fundamentals of programming

Duplication, as the name suggests, is something that exists more than once. The same goes for code duplication. It's code that exists many times in the same codebase. An increase in the codebase, a subsequent rise in code duplication - is this what's happening with you? If yes, then: Have you ever thought about why this happens? The code duplication subsequently increases with time as many developers work simultaneously on similar functionalities in the codebase. Is it a good programming practice? No, because coding works on a fundamental principle called DRY, i.e., Don't Repeat Yourself! We must follow the

How to optimise localization in iOS Swift App?

It's never been as easy as it is now to launch into global markets via mobile apps. You must be wondering why I wrote this blog because we can easily support varying locales to understand and be usable by all users, right? Let's read why. Earlier, providing L10n (localization) was just possible natively by integrating .strings, .stringsdict and .plist files in Xcode. This approach had various drawbacks such as: App's language would be set to the device's language by default instead of choosing the preferred language. There was no out-of-the-box support for .json. However, JSON support could be accomplished natively

Optimizing data retrieval using Realm Swift query

This article gives insights on Realm Extension Functions, through which time taken for a filter on the database is drastically reduced.

Video Hosting Platforms for Mobile Apps - A comparative study!

There are ample video hosting platforms available on the internet. Choosing a video hosting platform is a critical decision as it should go hand in hand with your long-term hosting requirements, alongside taking utmost care of security breaches for copyrighted content. The video hosting platform that we have been using for one of our web apps is Wistia. Why did we choose Wistia for our Web App? Embeds seamlessly in any websiteEnsures data security through domain restrictionsProvides in-video formsCustomizable video controls, and much more.What's the challenge to use it in Mobile Apps? The challenge came in when we wanted

10 Xcode shortcuts every iOS Developer should know

Whether beginner, intermediate or advanced developer, we all want to achieve our task by developing workable code. We want to accommodate changes soon to ensure efficiency too. But what if we are not too familiar with the IDE? We land up doing things that take much more time & effort than required. Xcode has a wide variety of these shortcuts, so here are some of them which helped us achieve our tasks faster: Move Line Up Command(⌘) + Option(⌥) + [ shifts the selected piece of code upward, to rearrange the current code. Alternatively, we can also use the same shortcut via Editor

Preferable Dependency Manager: Swift Package Manager(SPM) or CocoaPods

Recently, while using CocoaPods in my project, I realised the build time was taking longer. This led me to experiment with Swift Package Manager(SPM). So here I am sharing my findings with you based on these six criteria: 1.  Library Support: Even though both CocoaPods and SPM support Objective-C as well as Swift, CocoaPods has extensive support for varied types of libraries that help us in customising the project as per the user requirement. SPM is provided by lesser libraries resulting in fewer options to choose from. 2. Maturity: CocoaPods is a much stable and mature package manager than

Customize native alert view in iOS

Nearly every project/app needs an alert popup. It is an essential UI element to: Provide information/warning to the user before performing any actionHandle user interaction to perform any actionNotify the user on completion of an actionThe default alert popup is very simplistic. Nowadays, we see a unique style and attractive UI in popups rather than showing a classic native/default one. What do you show in a popup? Title, message, image, and action buttons. Isn't it? But if you want to make your custom alert popup, it requires a lot of effort as you need to manage UI

Integrate SwiftUI in the existing project(Storyboard)

In the current era, it is tough to remain stuck in the same way of doing things. Eventually, we all need to learn, transition and evolve. The same goes for technology as well. That doesn't mean we need to rewrite or redesign what we have developed in the past. Instead, we can start implementing new ways in conjunction with the current one, thus making it interoperable. SwiftUI has been a significant change that came in much after storyboards in Xcode. Ever since the announcement, everyone has been inquisitive about playing with SwiftUI. What is SwiftUI? According to the official Apple

Dynamic UIButton Font Size in Swift

In today's fast-paced world, everyone wants the comfort of preferences. With it comes the preference to personalize their devices too. This can be in the form of dark/light mode, wallpaper, ringtone. So do they get the flexibility of adjusting font size suitable to their eyes too? Yes, they get it! Dynamic font sizes make an app readable without much effort. We can implement dynamic font sizes using (Attributes Inspector → Font → Text Styles). Same illustrated below: a. Dynamic Font Setting for UILabel Note: Don't forget to select the Dynamic Type checkmark as shown in the last step above. Without it,

Setup React Native Web App with TypeScript and WebPack

In this tutorial we will setup react native web app locally and deploy on Render. Before we start with the react-native-web setup, I assume that you have installed Node.js, Yarn and react-native-cli on your machine. 1. Setup React Native App with TypescriptTo create react native app you need to run following command react-native init ReactNativeWebApp This command will create react native app and your app directory will look like as shown in the following image (image 1.1) image 1.1: Project rootTo add typescript to our app first we need to install react-native-typescript-transformer yarn add --dev react-native-typescript-transformer typescript