Skip to main content

Posts

Showing posts from January, 2019

How to open a particular View Controller when the user taps on the push notification received?

Thank you for joining. Lets start First of all we will go through the Push notification flow  Push Notification Flow Here, I am considering that everyone has gone through APNs(Apple Push Notification service). If not then first go through this link . How the push notification flow takes place? Above image will help you understand the flow easily which is as follows: Your app registers for Push notification service. The device in which app is running will request for device token from APNs server along with device certificate. APNs will validate the certificates of application and generate a app-specific device token. APNS will send the device token to the application. This device token is then send to your/FCM server which will be providing notification. So whenever any interesting thing happens, your/FCM server sends push notification request along with device token to APNs. APNs decrypts the token to ensure the validity of the request and to determine the target device an

Swift programs to print different star patterns

Hello All. Thank you for joining. As we all know, everyone in the software domain goes through the tasks of printing patterns in an interview process. However, sometimes it seems difficult for a beginner to perform these tasks. So here are some programs in Swift to print different patterns which might help. Please feel free to correct me if I am wrong. Pattern 1:  Given a number int, write a program to print a below shape with n rows. Solution: func  upsideDown( _  int :  Int ) {      for  i  in   0 ...int- 1      {          print ( String . init (repeating:  "*" , count: int-i))      } } upsideDown ( 6 ) Pattern 2:  Given a number int, write a program to print a below shape with n rows. Solution: int = number of rows i = row number from 1 to int So count number of spaces and stars in each row and accordingly find the expression For this pattern expression is: Spaces count = int - i Star Count =