RxSwift zip operator when one observable can fail

Recently I ran into a situation where I had to make two independent API requests and one of the API requests was discardable. I was sure that Observable.zip was the way to go. So i went ahead and implemented, My code looked something like this This was apparently very easy to implement and worked well … Read more

Breaking a large Switch case into multiple switch cases

Many a times we stumble upon Switch cases which run into 100s of cases. Ideally it should be under 30 (highly subjective) or any other number which you deem manageable. In the given below code example we will break a switch case into multiple ones. The above code example utilizes 100 + default cases in … Read more

Your app using node-cron could be on a delayed fuse

EDIT:- node-cron version > 3.0 has resolved the issue Node cron (npm i node-cron)is an excellent library and it serves it purpose quite well unless you decide to use Time Zone dependent cron, then this library might expose you to a delayed bug as the code will work right 6 months a year. The CODE … Read more

Certificate is not trusted mac keychain

Summary: Delete and reinstall WWDR and recreate certificate. I came across a weird issue while making enterprise certificate from apple developer. I followed all the steps required to make a certificate. The steps whereas follows Create a CSR file Create a certificate on the developer centre Upload CSR file Generate and download certificate Now the … Read more

The application bundle does not contain a valid identifier

On rare occasions Xcode will refuse to run your app on a device and you will come across this error The application bundle does not contain a valid identifier. Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402653108 Xcode One of these three steps given below will resolve the issue for you Clear Derived Data Delete derived data then clean … Read more

Shuffle an array in Swift

Swift now comes with built in shuffle functionality. Swift provides two methods shuffle() Shuffle reorders a collection in place. After calling shuffle on the collection the original collection is changed/reordered Since shuffle() is mutating in nature you cannot use it with constant declared using let keyword. It has a complexity of O(n), where n is the length … Read more

Your application has presented a UIAlertController of style UIAlertControllerStyleActionSheet

This happens when you try to present a action sheet in iPad. Luckily you can make your action sheet work across iPhone and iPad without writing different code for specific platform.Using popoverPresentationController?.sourceView an example code is given below This will remove the crash and you will achieve desired behaviour in both iPhone and iPad