Tag Archives: iOS

What are the built in shapes in swiftUI and how to use them?

By | February 8, 2025

SwiftUI supports some in-built shapes that are used to develop a custom design and user interface component. These shapes are easy to use and can customized in various style, colors, fills, transformations, etc.  2. Rectangle 3. Rounded Rectangle. SwiftUI also provide built-in RoundedRectangle() to create a rounded rectangle shape. The rounded rectangle is a very useful shape… Read More »

How different is swiftUI with respect to UIKit?

By | February 7, 2025

SwiftUI and UIKit are both iOS development frameworks, but they differ significantly: SwiftUI: Declarative UI design UIKit: Imperative UI construction 2. Code Complexity SwiftUI: Shorter, more readable code UIKit: More verbose, requires more manual configuration 3. Layout Approach SwiftUI: Uses modern compositional layouts with stacks and modifiers UIKit: Relies on Auto Layout and frame-based positioning… Read More »

How multi threading and concurrency is achieved in SwiftUI ?

By | February 5, 2025

SwiftUI handles concurrency and multithreading primarily through Swift’s native concurrency features and some SwiftUI-specific patterns. Here’s a comprehensive breakdown: These concurrency features are designed to work together seamlessly with SwiftUI’s declarative nature, ensuring that: The key is that SwiftUI abstracts away much of the complexity of traditional multithreading while providing powerful tools for handling asynchronous… Read More »

How to use GeometryReader for containing one view in another in swiftUI?

By | February 3, 2025

There are different ways to limit or constrain a subview within its superview in SwiftUI. ‘GeometryReader’ is one among those for relative sizing of the subviews in a view. We will see different ways of using ‘GeometryReader’ in below examples. 2. CenteredContentExample: 3. ResponsiveContainerExample: 4. ProportionalContainerExample: Key tips for using GeometryReader: a. Always account for… Read More »

Latest changes in swiftUI

By | February 2, 2025

Today we will take you through latest changes apple brought in swiftUI. Let me highlight some of the most significant practical changes that developers should focus on. Latest SwiftUI Changes and Features 1. Layout and View Enhancements New Layout Types Layout Modifiers 2. Data Handling Improvements Observable Pattern Data Flow 3. UI Components and Interactions… Read More »

What “URL encoding” or “percent encoding” is?

By | January 30, 2025

Read about what ‘addingPercentEncoding‘ is and why it’s important in URL handling. addingPercentEncoding(withAllowedCharacters:) is a String method in Swift that encodes special characters in a string to make it URL-safe. This is often called “URL encoding” or “percent encoding.” Let me break this down with examples: Why URL encoding is necessary? Common character encodings: Here’s… Read More »

Read from plist file in iOS / Swift

By | January 29, 2025

What is Plist file? A Property List (Plist) file is a specialized file format used to store structured data. Plist files can contain various data types, including dictionaries, arrays, strings, numbers, dates, and binary data. They are widely used in Apple development for various purposes, such as app configuration, user preferences, and data serialization. Plist files have a .plist file extension and… Read More »

How to display solid shapes in swiftUI?

By | October 6, 2024

Sometimes we need to display basic shapes in our apps just to get more attractive UI or just to highlight something. SwiftUI has several build in shapes to help the user to ease the development. It has several built-in shapes such as rectangles, circles, and capsules, each of which can be created, color, and positioned… Read More »

How to play movies with VideoPlayer

By | September 29, 2024

Playing movie or videos from any source is important when it comes to application development. Apple provides some default frameworks to handle it. SwiftUI’s VideoPlayer view lets us playback movies from any URL, local or remote. It comes from the AVKit framework, this can be added to the framework by importing AVKit. The below example shows how… Read More »

How to expose swift class to react native class?

By | September 10, 2024

There will be situations where you have to expose your Swift class to React Native. To do this, you need to use some Obj-C Macros available in React Native. To use these Obj-C Macros, you need a new Obj-C file: You have to import RCTBridgeModule, so that you can use the Macros to bridge the native… Read More »

How to use privacySensitive in swiftUI?

By | August 27, 2024

SwiftUI lets us mark some parts of our view as containing sensitive information, which in practice allows us to hide or show it more easily using redaction. To use this feature in your code, first add the privacySensitive() modifier to any views that should be hidden, then apply the .redacted(reason: .privacy) modifier at a higher place in your view… Read More »

How to adjust text alignment using multilineTextAlignment()

By | August 13, 2024

Like many other text UI’s SwiftUI’s Text wraps across multiple lines, they align to their leading edge by default. You can change that behavior, by using swiftUI’s ‘multilineTextAlignment()’ modifier to specify an alternative like .center, .trailing etc. For example, this will center several lines of text as they wrap across lines: Let’s use a picker… Read More »

How to add advanced text styling using AttributedString in swiftUI?

By | August 5, 2024

In our previous post we talked about styling swiftUI text views with fonts, colors, line spacing and more. This time we will look deep into ‘AttributedString’. SwiftUI’s ‘Text’ view is able to render more advanced strings created using ‘AttributedString’ struct. This includes adding underlines, strike through, web links, background colours etc. We will show you… Read More »

Styling swiftUI text views with fonts, colors, line spacing and more

By | July 10, 2024

A text view draws a string in your app’s user interface using a body font that’s appropriate for the current platform. You can choose a different standard font, like title or caption, using the font(_:) view modifier. Text views give us predictably wide range of controls in terms of how they look. They are also designed to work seamlessly alongside core apple… Read More »

How to customise NavigationStack background in swiftUI?

By | June 22, 2024

The view background can extend to the corners of the view. This will affect the navigation bar background. This will go behind large and inline navigation bars. For example, in below example the background colour is applied to the whole screen, but it is covering the navigation bar background too. The new initializer introduced with… Read More »

How do I implement pull to refresh in SwiftUI?

By | June 11, 2024

There are two main approaches to implementing pull-to-refresh functionality in SwiftUI, depending on your SwiftUI version and desired level of customization: 1. Using the built-in refreshable modifier (iOS 16+) If you’re targeting iOS 16 and above, SwiftUI offers a built-in refreshable modifier that simplifies pull-to-refresh functionality for List and ScrollView. Here’s how to use it:… Read More »

How to use ‘AsyncImage’ in swiftUI?

By | May 27, 2024

AsyncImage is a component introduced in SwiftUI to handle the loading and displaying of remote images asynchronously. It simplifies the process of fetching images from the web, handling the loading state, and displaying a placeholder until the image is ready. Here’s a detailed breakdown of how AsyncImage works, its customisation options, and usage examples. Basic… Read More »