
Don’t Adore Patterns So Much
Many people born in the 90s like me have witnessed how fast the Internet has been developed and spread. The areas of use of the Internet can be described as numerous, but in my opinion, the biggest advantage is that it enables us to access the most up-to-date, top-notch information in any field. As a matter of my profession, I have to read articles on software development and examine new patterns. I take notes some of what I have read and try to apply them in my current projects. This is a good approach however, it can keep you from your own path and constantly push you to make your code perfect as much as possible. If you become obsessed about the patterns, your code may get ahead of your idea waiting to be implemented.
According to estimates, the average lifespan of mobile applications is around 1 year and and during that time at least 3-4 updates of that app is produced. Do you think there is a need to scrutinize the code so much? How logical is it to build neat and flawless structures without being completely sure that your idea has a real buyer?
In that manner, I follow two different scenarios. If I write an enterprise app, I choose methodical way and try to keep everything is well-documented. However, I choose fastest way and don't addict to patterns if I need the reactions against my idea.

iPhone 11 Pro Super Retina XDR Display to be Accompanied by @4x?
Apple holds an event every September that's used to unveil new iPhones and Apple Watch models. This year, Apple updated its line of iPhones for 2019 at an event on 10 September, announcing the iPhone 11, iPhone 11 Pro and iPhone 11 Pro Max. Refreshed iPhones come with a list of greatly stunning specs.
As expected, the iPhone 11 has almost the same design as the XR, and the 11 Pro and 11 Pro Max have almost the same designs as the XS and XS Max. The camera features are impressive, even stacked against the iPhone 11 Pro, the design and new purple shade are beautiful, and the price is right. The promise of longer battery life than the already impressive iPhone XR is a bonus.
Aside from the features that thrill the end-user, such as design, performance and battery life, developers are sure to have a few questions.
As many of the audiences have noticed, Apple has launched the iPhone 11 Pro, which are equipped with Super Retina XDR display with a screen size of 5.8-inch for iPhone 11 Pro and 6.5-inch for iPhone 11 Pro Max. According to Apple, it is the sharpest and brightest display that the is put into an iPhone with a maximum brightness level of 1,200 nits and 458 pixels per inch. This eye-catching screen resolution raises the following question:
In the following Xcode update, are we going to see a new size of image as @4x?
As it is declared in Apple Documentation:
High-resolution displays have a higher pixel density, offering a scale factor of 2.0 or 3.0 (referred to as @2x and @3x). As a result, high-resolution displays demand images with more pixels.
If Apple decides to go straight to @4x for Super Retina XDR Display, it would require more graphics processing power, more LED light, and more battery, and that would be not surprising given the new features.
Thanks for reading!

My Very First Research Paper
Hello everyone,
The research paper, which me and my advisor had worked on, was published by courtesy of Springer.
This paper proposes a prototype UAV based solution, which can be used to hover over tomato fields, collect visual data and process them to establish meaningful information that can used by the farmers to maximize their crop. Furthermore, the findings of the proposed system showed that this was viable solution and identified the defected tomatoes with the success rate of 90%.

Custom AlertView using Builder Pattern in Swift
Although UIAlertController fits or satisfies necessary requirements on many or most occasions, sometimes we need to display alerts in more customizable way. By doing so, you can have configurable and colourful components in your alerts. Here it is, I will explain how you can create your own flashy custom alert view. Oh, and as a side note, I'm open to any ideas as to the best way forward. Feel free to contribute this repository.
Before you go, I would recommend you to being familiar with following terms:
- UIStackView
- Xib
- Builder Pattern
I am going to explain briefly how I made this out. I will not show you all xib and storyboard connections. You can find more details about in the repository.
Firstly, I created a view controller named CustomAlertView that includes a vertical UIStackView to add our alert view components.
It is easy to inserting and removing subviews in stack view. Also it requires less auto layout consideration.
Stack views let you leverage the power of Auto Layout, creating user interfaces that can dynamically adapt to the device’s orientation, screen size, and any changes in the available space. The stack view manages the layout of all the views in its
arranged
property. These views are arranged along the stack view’s axis, based on their order in theSubviews arranged
array. The exact layout varies depending on the stack view’sSubviews axis
,distribution
,alignment
,spacing
, and other properties.
Also, I have created a CustomAlertViewDelegate file that is used to control button actions.
After that, I have implemented many components that can be used in our stacked alert view. These are single label component, one to multiple button components, and image component. All views are created from XIB files. You can see them in the repo files.
Here is the code snippet of the each custom view.
Now it is time to create an alert builder class that provides a flexible solution to various element creation in our alert view.
When you run my test application you will see the following example:
Thanks for reading!

We are About to Hire You, But…
Whenever you assign a class instance to a property, constant, or variable, that property, constant, or variable makes a strong reference to the instance. A weak reference is a reference that does not keep a strong hold on the instance it refers to, and so does not stop ARC from disposing of the referenced instance. Unowned reference does not keep a strong hold on the instance it refers to. Unlike a weak reference, however, an unowned reference is used when the other instance has the same lifetime or a longer lifetime. I did not trouble to list questions from easy to difficult. It totally shows up how it comes to my mind, unordered.
Let’s fire it up!
1. How does ARC works?
With iOS 5, Apple released ARC, which means Automatic Reference Counting, is a really nice-to-have feature on behalf of iOS Development. It decreases or increases reference count of an object by regarding relationship with another objects. For example, when you create an object, reference count becomes 1. Each strong reference between objects increments reference count by 1. Whenever it reaches to 0, object can be deallocated. ARC only performs to instances of classes. Because Class creates reference-type instances otherwise, enum or struct create value-type instances.
Whenever you assign a class instance to a property, constant, or variable, that property, constant, or variable makes a strong reference to the instance. A weak reference is a reference that does not keep a strong hold on the instance it refers to, and so does not stop ARC from disposing of the referenced instance. unowned reference does not keep a strong hold on the instance it refers to. Unlike a weak reference, however, an unowned reference is used when the other instance has the same lifetime or a longer lifetime.
3. What is a memory leak?
Memory that was allocated at some point, but was never released and is no longer referenced by your app. Since there are no references to it, there’s now no way to release it and the memory can’t be used again.
4. How does retain/strong reference cycle occur?
Even ARC works like a stonker, You can still have some pitfalls.
It’s possible to write code in which an instance of a class never gets to a point where it has zero strong references. This can happen if two class instances hold a strong reference to each other, such that each instance keeps the other alive. This is known as a strong reference cycle.
5. What is the difference and common things between Class and Struct?
Classes and structures in Swift have many things in common. Both can:
- Define properties to store values
- Define methods to provide functionality
- Define subscripts to provide access to their values using subscript syntax
- Define initializers to set up their initial state
- Be extended to expand their functionality beyond a default implementation
- Conform to protocols to provide standard functionality of a certain kind
Main difference between them is, Classes are reference types, Structures are value types.
6. What is the definition of Protocol and Extension?
A protocol defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementation of those requirements. Any type that satisfies the requirements of a protocol is said to conform to that protocol.
Extensions add new functionality to an existing class, structure, enumeration, or protocol type. This includes the ability to extend types for which you do not have access to the original source code (known as retroactive modeling). Extensions are similar to categories in Objective-C. (Unlike Objective-C categories, Swift extensions do not have names.)
7. What is CocoaPods?
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 47 thousand libraries and is used in over 3 million apps. CocoaPods can help you scale your projects elegantly.
8. Is there any open source library that you get advantage of it in your application?
- Alamofire and AlamofireImage — Network Layer
- Spring — Animation UI
- Reel search — Search UI
You can express more libraries for different categories.
Thanks for reading!

Simple Approaches to Auto Layout in iOS Development Part 2
If you are one of the newcomers to this series, you might want to take a look at Part 1 that you can find out where I have started to tell something about Auto Layout. In this part, I will talk about how to add UIScrollView that contains a label and also it is going to have dynamic height by the help of Auto Layout magic!
You can have the following attributes for your view controller when you accomplish the things are mentioned in this article:
- Without switching Autoshrink on, you can have labels with fixed font size for all devices, regardless of the label’s length.
- No-coding required for content size of UIScrollView.
- Open Xcode (Create New Xcode Project > Single View App)
2. Select Main.Storyboard from Project Navigator
2. Drag out an UIScrollView from the object library and add it to the View Controller:
Optional: You can set a background color to UIScrollView that helps you distinguish it from views that we are going to add.
- Add Constraints to UIScrollView as follows:
- You can check constraint from size inspector.
3. Drag out an UIView from the object library and add it to the UIScrollView:
→ Add Constraints to UIView:
- Firstly, UIView’s trailing, leading bottom and top space to UIScrollView must be set to 0.
4. Add an UILabel to UIView with constraints:
Note: After you add the UILabel, Don’t forget to set Lines to 0 in Attributes Inspector of UILabel. Otherwise, It will be single line UILabel.
4. Add Equal Height and Equal Width constraint to UIView with Safe Area
5. Change equal height priority of UIView to 250.
- Select Equal Height constraint from Document Outline.
- You will see detail of the selected constraint in the Size Inspector.
- Click Priority and select Low (250) from drop-down list.
This is how it looks like those 3 steps:
Now, it is time to try how UIScrollView works with different length of text in UILabel. To get a random text, I generally use Lorem Ipsum Generator.
Check this out!
Click here to see how longer text works with UIScrollView.
Thanks for reading!

Simple Approaches to Auto Layout in iOS Development Part 1
Auto Layout is a powerful feature of iOS development that makes user interface manageable for all view hierarchies that diverse on different iOS devices. This feature has been announced with iOS 6 and gone further in every new SDK release. Let’s leave aside introduction part and dig down to the auto layout.
Today, I am going to demonstrate step by step how to place multiple views on screen with equal height.
Follow these steps:
- Open Xcode (Create New Xcode Project > Single View App)
2. Select Main.Storyboard from Project Navigator
As you can see there are a lot of UI Components, but this time we don’t need any of them but UIView. You get it from object library which is shown in lower right corner of following screen shot.
3. Drag and Drop 2 views over the view controller’s view and set different background colors to distinguish them.
4. Now it’s time to set constraints for both views.
Select upper view and click Add New Constraints which is located at second from right on the following screen shot.
After that, set constraint for upper view and tap bottom button as following:
Also, set constraint for lower view:
Now, you will see some red lines around views, which indicates some constraints are missing, that you need to fix it by adding equal height attribute.
5. To create a constraint between two views, Control-click one of the views and drag to the other.
When you release the mouse, You will see possible constraints displayed with a HUD menu. Select Equal Height.
6. You have done it!
Now you can run application and see it is going to fit perfectly in every different iPhone simulator.
Keep up with new articles 🙂