Posts

Swift 4— Access Control

Access control  restricts access to parts of your code from code in other source files and modules. This feature enables you to hide the implementation details of your code, and to specify a preferred interface through which that code can be accessed and used. You can assign specific access levels to individual types (classes, structures, and enumerations), as well as to properties, methods, initializers, and subscripts belonging to those types. Protocols can be restricted to a certain context, as can global constants, variables, and functions. In Swift 3 and swift 4, we have  open ,  public ,  internal ,  fileprivate , and  private  for access control.Open access is the highest (least restrictive) access level and private access is the lowest (most restrictive) access level. As of  Swift 4 , there are 5  levels of access , described below from the highest (least restrictive) to the lowest (most restrictive). 1.  open  and  public —  (least restrictive) Enable an entity t

Property vs Instance Variable (iVar) in Objective-c [Small Concept but Great Understanding..]

Do you use properties or instance variables to store something inside an object? Let’s understand what is better and when. I think the subject is much less arguable if it’s about getting/setting some data from outside the class (right, properties should be used). So in this post we will focus on private and protected class members. Does it matter? It might sound not that important – why can’t we just make a random decision and stick to it? Well, properties / ivars are something that is used all the time. I think it’s a good practice to sometimes pay attention to how we do common tasks. It’s natural, and it’s a good way to increase efficiency as well – even a slight improvement sums up to something quite significant within time.  Performance Obviously, using properties will cost you some CPU because additional methods get called. But this is so insignificant in 99.99% of the cases! And for the rest 0.01% – use ivars, but be aware that the improvement you get is almost nothin

How to make your iOS apps more secure with SSL pinning

Image
SSL pinning plays a major role in building highly secure mobile apps which users will be able to use even in countless insecure wireless networks that they encounter every day while using their mobile devices. Here at Infinum, we have a solid chunk of experience in working on apps that require high-security standards, such as mobile banking apps. This article covers the SSL pinning technique that helps us deal with one of the most common security attacks -  MITM  or man-in-the-middle. At a glance SSL (Secure Socket Layer) ensures encrypted client-server communication over HTTP - specified by HTTPS (HTTP over SSL). The encryption is based on PKI (Public Key Infrastructure) and a session key. The session key was introduced because encrypting and decrypting a public/private key uses a lot of processing power and it would slow down the whole communication process.  Instead of having to asymmetrically encrypt data at the source and decrypt it at the destination, a symmetric