The Must Knows for iOS Developers III

Okay, so folks let’s under-lime your curiosity little bit more by learning out the iOS developers must know facts. This article would be third in the series, so if you haven’t read previous posts, then you should immediately redeem it. However, you can read the earlier posts after reading this one first. So, people the few more iOS developers must know are like as;

-1. CollectionViews & TableViews

Every app has one or more than one views to show data. The knowledge of each view and how can you use them is very vital to understand future complications of your apps.

TableViews shows the list of items in the single column or vertical manner and it only supports vertical scrolling. In this view, every item is represented by UITableViewCell which can be totally customized. You can sort them according to sections and rows as well.

CollectionViews as well show the list of things but in the multiple columns and rows. It can be scrolled vertically and horizontally both. Here, items are represented by the UICollectionViewCell, these can be easily customized and sorted into sections and rows.

These both views are similar in functionality and use cells in the same manner. Selecting one view truly depends on your list of items. The collection view can be used to represent any form of a list. However, like if you want to create the simple contact list, the table view will be an easier option. Plus, if you want to ever change the view of your app, then you just have to change the UI implementation of it and rest will automatically change.

It doesn’t matter whether you select the collection or table view, just make the good generic choice as it’s going to make implementation easier for you.

-2. Storyboards vs. Xibs vs. Programmatic UI

Well, each of the following methods can be used to create a UI, however, you can combine them all to create a quirky view.

Storyboards let the broader view of the project which makes the job of the designers easy. But, the negative side is that as more screens are inserted, the structure of connection become more cluttered and storyboard load time increases eventually. The merge conflict issue occurs a lot because the whole UI belongs to the one file. These issues are much more difficult to resolve.

Xibs offers a visual view of the screen or portion of it. The advantages of this view are; easy to reuse, less merge conflict then storyboard and an easy way to see content on the screen.

Programming the UI offers you hell lot more control over it, less chance of merge conflicts and easy to resolve them. However, it has one downside that the lack of visual aid and extra time is required to program.

-3. Protocols

Protocols are integrated part of our daily life which gives us a solution to react in the particular situation. It defines as a draft of the methods, properties, and other requirements. Protocols can be adopted by any class, structure or enumeration that will further let you actually implement the requirements. Here the example to create and use the protocols.

For instance, you need to create the enum with the different types of materials used to extinguish the fire;

enum ExtinguisherType: String {
case water, foam, sand
}

Next, create a protocol that response to urgent situations;

protocol RespondEmergencyProtocol {
func putOutFire(with material: ExtinguisherType)
}

Now, create the fireman class to confirm the protocol;

class Fireman: RespondEmergencyProtocol {
func putOutFire(with material: ExtinguisherType) {
print(“Fire was put out using (material.rawValue).”)
}
}

Finally, put this fireman class into action;

var fireman: Fireman = Fireman()
fireman.putOutFire(with: .foam)

Well, people, we got to end our series here, but don’t worry we will be back with another existing series very soon. Till then keep on reading and sharing our posts.

Send a Message