What Is an indexPath in Swift?

In Swift, an indexPath is a list of indexes that, together, represent the path to a specific location in a tree of nested arrays.

It describes an item’s position inside a table view or collection view, storing both its section and its position inside that section.

How to Use a Coordinator Pattern to Separate Concerns in iOS

Let’s talk about view controllers. Right off the hop, stop making a mess of your view controllers and start putting your code in logical places – view controllers are for views, and views only. It’s very tempting to throw all sorts of logic into a view controller, but when we separate concerns, we write code that’s easier to understand and easier to reuse.

There are handfuls of responsibilities we can dump into a view controller: data fetching, data transformation, user input, model-view binding, model mutation, animations, and navigation flow, just to name a few. But, we shouldn’t house all of these responsibilities in one place; otherwise, we’re working with a confusing and unwieldy view controller.

Dictionaries in Swift

Swift

Recently, I have been learning and coding in Swift. Swift is a powerful and general-purpose language. As a seasoned Java developer, I can correlate some of the Swift's concepts and it is easy to learn.

In this article, I would like to introduce and delve into the dictionary in Swift. Dictionary is a container which stores key-value pairs. All the keys in the dictionary are of the same type and all the values are of the same type. The order in the dictionary is not maintained. If you are a Java developer, you can correlate this to a Hashtable which gives fast access to its entries.

Method Internals in Swift 5.0

One of the nice things about Swift 5 is the final stabilization of the ABI. This is actually a big deal. The application binary interface defines exactly how data is stored in programs, shared from libraries, things like that. It includes name decoration, class and object definitions, and so on. Now that we have a stable ABI, building tools that analyzed and manipulate these binary representations will become much, well, not easier, but not as much a waste of time. Until now, you were just about guaranteed to have any tools you created broken by new Swift versions. With a stable ABI? This shouldn't happen.

We just covered how classes are defined in Swift 5, and we discovered that they reflect the basic design in Objective-C. There are some key differences though, and one of those is member method definitions.

Swift Class Disassembly

In a previous article, we looked at the disassembly of class creation and program semantics for a simple program that prints a string. It did expose how classes are defined and how objects are reference counted however, as simple as that example was. Now we're going to look at an equivalent Swift program

This swift program is equivalent to the Objective-C program, right down to the method names: