Swift if case pattern matching
We are all familiar with the error “Switch must be exhaustive”. Adding a default or adding all cases can resolve this error condition but what if
Swift is the new language introduced by Apple and is used for developing application in iOS platform.
We are all familiar with the error “Switch must be exhaustive”. Adding a default or adding all cases can resolve this error condition but what if
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
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
Using a broad type allows us to keep our code modular and manageable. It allows us to extend functionality at will. But at times we need to go specific to use the functionality specific to a particular type. In swift, we use inheritance and protocol as broad types as shown below As you can see … Read more
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
There are flows in your app where you want to return to the very beginning of the application. It can be due to session expiry or end of flow in a linear activity like filling multipage forms or any other scenario. You want to come back to the beginning of the app. This can be … Read more
To get the topmost view controller in Swift you need to take into account the presented viewcontrollers. This can be achieved in the following ways You also need to take into account iOS 13 + versions Happy coding !!!
There are situations where we need to use the UIProgressView as a count-down bar. We want to count it from 1 to 0. There are two ways in which this can be achieved. Flipping the UIProgressView This is the old solution that can be used if you are supporting below iOS 9.0. In this method, … Read more
We understand that AVPlayerViewController is a ViewController and like all view controllers, it takes full view when it’s either pushed or presented. But it can also be rendered as a subview with a custom frame by adding it as a child viewcontroller. The approach is pretty straightforward. The code given below plays a video from … Read more
Saving Array is pretty straightforward Ready array is also quite simple you can remove the array by usng Cheers !!!