Category: Uncategorized
Swift Concurrency -Manage API Calls in SwiftUI
Managing API calls efficiently in SwiftUI is crucial for building responsive and user-friendly apps. By using a network service class and Swift concurrency with async/await, you can handle API requests smoothly. This guide will show you how to structure your code to manage API calls, handle errors, and display appropriate messages to users. Step 1:…
How to Create a ViewModel with Dummy Data for UI Testing
In this guide, we’ll walk you through the process of creating a ViewModel and loading it with dummy data from a JSON file for UI testing. This will help you test your UI with realistic data without relying on a network or external data source. Step 1: Define the Data Model First, create a struct…
Xcode Playgrounds: Documenting Your Code with Markup
One of the coolest features of Xcode Playgrounds is the ability to add rich, formatted documentation right alongside your code. This is done using a special kind of comment called “markup”. Basic Markup To use markup, start a line with //:. This tells Playground that this line is markup, not code. Here’s an example: Rendering…
Clear CocoaPods cache, re-download and reinstall all pods
Here is the code snippet to clear CocoaPods cache then re-download and reinstall all pods. rm -rf “${HOME}/Library/Caches/CocoaPods“ rm -rf “`pwd`/Pods/“ pod update Source
UITableView Demo in Swift
In this tutorial, we will see some of the common UITableView operations such as Adding, Updating, Deleting and Moving records using Swift. Let us start with a TableView placed over a ViewController instead of using UITableViewController. By this way you will learn lot more about the functionality of UITableView. Add a new file and select…
Keyboard Shortcuts in Xcode
Listed below are the various keyboard shortcuts in Xcode 7. Symbols corresponding to Mac keyboard used are command (⌘), shift (⇧), control (⌃), option/alt (⌥) Build, Run, Test Build ⌘ + BClean ⌘ + ⇧ + KRun Tests ⌘ + URun ⌘ + R Debug Step Over F6Step Into F7Step Out F8Toggle BreakPoint ⌘ +…
Fix for Directory not found for option error in Xcode
You might see Directotry not found for option error when opening an iOS 8 existing project in Xcode 7. This error because of the invalid path sepcifed from the Framework Path for the test target, (null): Directory not found for option ‘-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/Developer/Library/Frameworks’ This can be fixed by selected the test target, navigating Search Paths and…