Category: ios

  • Handling HTML Text Gaps in Swift

    When working with HTML content in iOS applications, developers often encounter challenges in displaying text with the proper formatting, especially when it comes to maintaining the gaps or spaces between paragraphs. In this post, we are going to explore a simple solution to ensure your HTML text is displayed with the appropriate paragraph breaks, enhancing…

  • Auto Layout in iOS

    Using Auto Layout feature developers can align UI controls for different devices, screen sizes and orientation. This reduces the code to be maintained and makes life easy for the developers. Auto Layout solves UI design issues by creating relationship between the UI elements. This follows constraint based layout system where you can define contraints for…

  • How to customize status bar in iOS

    Status Bar appears at the top of your device displaying information such as battery left in your device and carrier details. The default style of status bar is black and looks as shown in the below screenshot. But if your screen designs are dark then you can change the status bar style to Light Content.…

  • Closures, Extensions and Generics in Swift

    Closures Closures are self contained lines of code that can be passed around the application and similar to blocks in Objective-C. A typical closure syntax in Swift looks as shown below Closure Syntax { (parameters) -> return type in statements } Example closure in Swift var greetings = { (name:String, message:String) -> (String) in message…

  • Dependency Injection in Swift

    Dependency injection is a design pattern that lets you to pass the dependencies for the object instances instead of creating the them inside the instances. Let us see this with an example of an app that manages Expenses. In an Expense app we might have different components like ExpenseManager – Responsible of managing business logic…

  • Memory management in Swift

    Memory management in Swift is done by Automatic Reference Counting or ARC. Whenever a variables holds an instance of an object the memory count for that object increases by 1. And when variable becomes out of scope or set to nil, the memory count decreases 1. class Teacher { var name: String? var course: String?…

  • What are the different lifecycle methods in a typical UIViewController?

    Here is the list of Lifecycle methods in a ViewController are viewDidLoad – Called after the view controller’s view hierarchy has been loaded into memory. It is used for initial setup, such as creating and configuring UI elements. viewWillAppear – Called just before the view is about to be added to the view hierarchy and…

  • Explain App Life Cycle

    The app life cycle refers to the sequence of steps that app takes when an user launches an app until it terminates. Understanding the life cycle will help the developer to manage app behaviour and proper allocation and deallocation of resources. Image Credit :- Apple Not Running – Initial stage when the app is not…