Git revert to previous commit

There are situation when you mess up so bad you want to just go back and restart again. Fortunately If you are using Git then you can do it. We will be discussing ways in which git allows you to revert to previous commit 1.Git reset Git rest moves your head to a specific commit. … Read more

Change Status Bar text color in iOS

When you need to change the text color of status bar to white in order to enhance visibility you can proceed as shown below Set the UIViewControllerBasedStatusBarAppearance to YES in the .plist file. In the viewDidLoad do a [self setNeedsStatusBarAppearanceUpdate]; Add the following method: In order to cater for ViewControllers embedded in a NavigationController use this insted SwiftUI For swift UI add … Read more

Understanding UIView ContentMode with a simple example

Most of the time there is confusion about various content modes. I would like to clarify all 13 of them in this post. There are 13 content modes as listed below Scale To Fill Aspect Fit Aspect Fill Redraw Center Top Bottom Left Right Top Left Top Right Bottom Left Bottom Right Now I would … Read more

Making RGB colour in Xcode

I remember when I first tried using the colour directly from photoshop into my project the colours were appearing whitish while it was yellowish in photoshop the colour value was Color-R-160, G-97, B-5. though very basic but somehow I could not take into account that I need to give a value between 0 and 1.0. … Read more

Set UISegmentedControl selected segment color

Previously in order to set selected segment color in UISegmentControl we needed to loop through subviews and set the right one like this imagine the uncertainties 😀 But since Xcode 11+ we can directly set selected tint in storyboard like this. In iops 13 + we can also use selectedSegmentTintColor. Makes life easy.

Filter bad CLLocation objects in didUpdateLocations function

We get location objects in CLLocationManager’s The issue however is it also gives us some CLLocation objects which are low quality. Since plotting low-quality CLLocation or using them can lead to a bad user experience. We can solve this by using the following properties of CLLocation object horizontalAccuracy verticalAccuracy timestamp All the accuracy properties are … Read more