Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Separation of function declaration and definition in Swift

I'm having a look at the new Swift. I come from C, C++, Objective-C... I notice that in swift is not possible (?) to separate the declaration and the definition of functions. The result of this is that structure and class declarations are very long and bloated, and it is therefore difficult to have a "quick picture" of the class by looking at the code. Am I doing something wrong? Is there any approach to overcome this problem, besides trying to make functions small, etc.? Thanks in advance

like image 262
George Avatar asked Dec 20 '22 12:12

George


1 Answers

In swift, there is no separation of declaration vs implementation. This works like most other modern languages like Python. If you want to get a quick picture of your class, you should use code folding. Simply fold all your methods and functions. And unfold a method of you want to modify / work on it.

like image 60
Ray Perea Avatar answered Feb 01 '23 22:02

Ray Perea