How to iterate over a dictionary in Swift using a for loop?

Dictionaries are a powerful data structure in Swift that allow you to store key-value pairs. Key-value pairs are like tiny databases, where the key is the unique identifier for the value. This makes dictionaries very efficient for retrieving data quickly, as you can simply look up the value by its key. One of the most … Read more

How to disable zooming in a UIWebView in Swift?

To disable zooming in a UIWebView in Swift, you can use the UIScrollViewDelegate method viewForZooming(in:) to return nil, effectively disabling zooming. Here’s an example code snippet: In this code snippet, the viewDidLoad method sets the delegate property of the UIWebView to self, and the scrollView.delegate property to self as well, allowing us to implement the … Read more

Cool Swift Array Tricks

Swift is a powerful programming language that provides a wide range of useful features and functionality. One of the most commonly used data structures in Swift is the array. In this article, we will explore some cool Swift array tricks that can help you write more concise and efficient code. Initialising an Array with Repeated … Read more

How to Disable ARC for files in a project? Xcode

ARC can be disabled for a single or group of files in a project. Adding -fno-objc-arc  compiler flag for the selected files in Target->Build Phases -> Compile Sources disables ARC for those files. You can do it in simple two steps Go to Target – > Build Phases-> Compile Sources Select File/Files for which you want … Read more

Passing Data between View Controllers

A ViewController in an application is seldom standalone in nature. They require data from ViewControllers in front and from those behind them, this leaves us with two types of data passing Forward Data passing Backward data passing For discussing both kinds of data passing we have two ViewCotrollers ASViewController ASViewControllerB Forward data passing between ViewControllers … Read more

Xcode: Failed to update auto layout status

Once in a while we come across a situation where our storyboard or xib does not show the UI but only the frames with blue lines marking the views. This issue is caused due to Xcode not being able to read autolayouts and are more frequent on slow macs. The problem can be solved in … Read more

Resolving jerky UITableView Scroll

Hi We all have faced situation where scrolling of table view is not smooth.There can be many causes for the same. In order to speedup the scroll we can do a quick check 1.Avoid drawing. 2.Avoid manipulating layers. 3.Try to return cell as quickly as possible.for that you can move the data feeding for the … Read more

Dynamic height UITableViewCell using Auto layouts

How to create dynamic height tableview cell has been a very daunting task especially when you have to calculate and return variable row height in [code]- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;[/code] But with autolayouts its very simple.you just have to make sure that the constraints of the tableview cell subviews are added in such a way … Read more

iOS 8 CLLocationManager asking for user permission

Pre iOS 8 it was enough to allocate location manager object to generate a permission request locationManager=[[CLLocationManager alloc] init]; but post iOS8 things have changed, in order to initiate the the request for location information you have to do following steps Add keys in info plist NSLocationWhenInUseUsageDescription   : against this key description of the … Read more