Profile cover photo
Profile photo
Karunakar Bandikatla
140 followers
140 followers
About
Posts

Post has attachment
fileprivate to private
In Swift 3, If we need to access private stuff of a class in extension, we need to change the access specifier from private to fileprivate .           class User {           private var name: String      private var id: Int           init(name: String, id: ...
Add a comment...

Post has attachment
Swift Nil-Coalescing Operator for Optoionals
Let’s see how to use Coalescing operator for optionals in swift.           var name: String?   label.text =  name ?? "" Here ?? is the Coalescing operator which   checks whether optional is nil or not. If Nil, takes default value, If not takes optional. In ...
Add a comment...

Post has attachment
Protocol Extensions for Default and Convenient API
In this tutorial, let’s see how protocol extensions can be used as default and convenient API . I am taking a Movable protocol which is having a move method.           protocol Movable {      func move(at minimumSpeed: Float)   } I am creating a class calle...
Add a comment...

Post has attachment
Enum raw value comparisons
It’s a good practice to take an enum for TableView sections instead of writing if conditions for indexPath.section           if section == 0 {}    if section == 1 {}  Instead of this take an enum like below for example as a Profile screen.         enum Prof...
Add a comment...

Post has attachment
guard statement return/break/continue
This tutorial is for those iOS developers who still thinks that we can write only return in a guard else 😀 Here are the rules. We can write return in a guard else only inside of a function/method We can write break in a guard else only inside a loop (if, d...
Add a comment...

Post has attachment
Swift Comparable Protocol
Before reading this post, I would suggest to go through my post on Equatable protocol Because, Comparable protocol extends from Equatable Protocol. Equatable helps in comparing custom class objects and finding them in a collection. Comparable protocol helps...
Swift Comparable Protocol
Swift Comparable Protocol
iossolves.blogspot.com
Add a comment...

Post has attachment
Swift Equatable Protocol
In this tutorial, let’s see what is like confirming to Equatable protocol and where exactly it fits in app development. It’s quite often we compare things/objects.                   let currentAddress = "New York, America"          let selectedAddress = "Ne...
Add a comment...

Post has attachment
Multiple Inheritance using protocols, Diamond Problem
Multiple Inheritance is not available in Swift language. If you try you end up with below compile time error. We can achieve Multiple Inheritance using protocols in Swift. Combining behaviours and creating a concrete class using protocols. What if we have s...
Add a comment...

Post has attachment
Protocols vs Base classes
Ever got confused with using Base classes modal or using Protocols while developing app with Swift? Base class:           class Employee {      func work() {}  }  class Manager {  } Protocol:           protocol Works {      func work()  }  extension Works {...
Add a comment...

Post has attachment
Multiple Inheritance using protocols
In this tutorial, Let’s see how can we achieve multiple inheritance using Protocol oriented approach which is not possible using Base classes. I have an Employee base class and below child classes derived from Employee class. Programmer TeamLead ProjectLead...
Add a comment...
Wait while more posts are being loaded