Ramotion/expanding-collection

Question that is not really related to the product, but why using extensions?

Closed this issue · 3 comments

Hi Developers in Ramotion,

I was reading the example code included, and noticed that you are using extensions a lot. For example in DemoTableViewController, every methods are written as extensions.

Is there any reason/benefit why you are writing it this way?

BR
AnChin

I wanna know as well..

Swift 1 did not have pragma marks, which made extensions become the standard for code organization at the time.

The guidelines do not enforce this anymore, but it's still widely used.
https://swift.org/documentation/api-design-guidelines/

0ber commented

it's just coding style, read this article https://www.natashatherobot.com/using-swift-extensions/

... and it's more readable
image