[Question] Grand Renaming and Delegate/Datasource protocols!


(Jerome ALVES) #1

Hi everyone,

I can't find anything about Cocoa Delegate/Datasource protocol "Grand Renaming" for Swift 3
Is something planned about this ?

Because I find that actual names don't fit with Swift 3 API guidelines.

For instance :

func numberOfSectionsInTableView(_ tableView: UITableView) -> Int
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
func tableView(_ tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
func tableView(_ tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath)

func tableView(_ tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
func tableView(_ tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
...

could be renamed to something like this :

func numberOfSections(in tableView: UITableView) -> Int
func numberOfRows(inSection section: Int, in tableView: UITableView) -> Int
func cellForRow(at indexPath: NSIndexPath, in tableView: UITableView) -> UITableViewCell
func moveRow(at sourceIndexPath: NSIndexPath, to destinationIndexPath: NSIndexPath, in tableView: UITableView)

func heightForRow(at indexPath: NSIndexPath, in tableView: UITableView) -> CGFloat
func didSelectRow(at indexPath: NSIndexPath, in tableView: UITableView)
...

Kind regards,

Jérôme Alves


(Saagar Jha) #2

I believe that renaming of Apple’s frameworks is not in the scope of
swift-evolution; I think you’re supposed to file a radar.

···

On Mon, Jun 27, 2016 at 9:54 AM Jerome ALVES via swift-evolution < swift-evolution@swift.org> wrote:

Hi everyone,

I can't find anything about Cocoa Delegate/Datasource protocol "Grand
Renaming" for Swift 3
Is something planned about this ?

Because I find that actual names don't fit with Swift 3 API guidelines.

For instance :

func numberOfSectionsInTableView(_ *tableView*: UITableView) -> Int
func tableView(_ *tableView*: UITableView, numberOfRowsInSection *section*
: Int) -> Int
func tableView(_ *tableView*: UITableView, cellForRowAtIndexPath
*indexPath*: NSIndexPath) -> UITableViewCell
func tableView(_ *tableView*: UITableView, moveRowAtIndexPath
*sourceIndexPath*: NSIndexPath, toIndexPath *destinationIndexPath*:
NSIndexPath)

func tableView(_ *tableView*: UITableView, heightForRowAtIndexPath
*indexPath*: NSIndexPath) -> CGFloat
func tableView(_ *tableView*: UITableView, didSelectRowAtIndexPath
*indexPath*: NSIndexPath)
...

could be renamed to *something* like this :

func numberOfSections(in *tableView*: UITableView) -> Int
func numberOfRows(inSection *section*: Int, in *tableView*: UITableView)
-> Int
func cellForRow(at *indexPath*: NSIndexPath, in *tableView*: UITableView)
-> UITableViewCell
func moveRow(at *sourceIndexPath*: NSIndexPath, to *destinationIndexPath*
: NSIndexPath, in *tableView*: UITableView)

func heightForRow(at *indexPath*: NSIndexPath, in *tableView*: UITableView)
-> CGFloat
func didSelectRow(at *indexPath*: NSIndexPath, in *tableView*: UITableView
)
...

Kind regards,

Jérôme Alves
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

--
-Saagar Jha


(Dennis Lysenko) #3

FWIW, I rely on typing `tableView` and looking at the autocompletions to
find delegate methods.

Not that that makes this a bad idea, and I'm not sure how many other
developers do that (although I imagine quite a few do). Just food for
thought.

···

On Mon, Jun 27, 2016 at 11:44 AM Saagar Jha via swift-evolution < swift-evolution@swift.org> wrote:

I believe that renaming of Apple’s frameworks is not in the scope of
swift-evolution; I think you’re supposed to file a radar.

On Mon, Jun 27, 2016 at 9:54 AM Jerome ALVES via swift-evolution < > swift-evolution@swift.org> wrote:

Hi everyone,

I can't find anything about Cocoa Delegate/Datasource protocol "Grand
Renaming" for Swift 3
Is something planned about this ?

Because I find that actual names don't fit with Swift 3 API guidelines.

For instance :

func numberOfSectionsInTableView(_ *tableView*: UITableView) -> Int
func tableView(_ *tableView*: UITableView, numberOfRowsInSection
*section*: Int) -> Int
func tableView(_ *tableView*: UITableView, cellForRowAtIndexPath
*indexPath*: NSIndexPath) -> UITableViewCell
func tableView(_ *tableView*: UITableView, moveRowAtIndexPath
*sourceIndexPath*: NSIndexPath, toIndexPath *destinationIndexPath*:
NSIndexPath)

func tableView(_ *tableView*: UITableView, heightForRowAtIndexPath
*indexPath*: NSIndexPath) -> CGFloat
func tableView(_ *tableView*: UITableView, didSelectRowAtIndexPath
*indexPath*: NSIndexPath)
...

could be renamed to *something* like this :

func numberOfSections(in *tableView*: UITableView) -> Int
func numberOfRows(inSection *section*: Int, in *tableView*: UITableView)
-> Int
func cellForRow(at *indexPath*: NSIndexPath, in *tableView*: UITableView)
-> UITableViewCell
func moveRow(at *sourceIndexPath*: NSIndexPath, to *destinationIndexPath*
: NSIndexPath, in *tableView*: UITableView)

func heightForRow(at *indexPath*: NSIndexPath, in *tableView*:
UITableView) -> CGFloat
func didSelectRow(at *indexPath*: NSIndexPath, in *tableView*:
UITableView)
...

Kind regards,

Jérôme Alves
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

--
-Saagar Jha
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Brent Royal-Gordon) #4

I can't find anything about Cocoa Delegate/Datasource protocol "Grand Renaming" for Swift 3
Is something planned about this ?

Because I find that actual names don't fit with Swift 3 API guidelines.

For instance :

func numberOfSectionsInTableView(_ tableView: UITableView) -> Int
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
func tableView(_ tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
func tableView(_ tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath)

func tableView(_ tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
func tableView(_ tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
...

could be renamed to something like this :

func numberOfSections(in tableView: UITableView) -> Int
func numberOfRows(inSection section: Int, in tableView: UITableView) -> Int
func cellForRow(at indexPath: NSIndexPath, in tableView: UITableView) -> UITableViewCell
func moveRow(at sourceIndexPath: NSIndexPath, to destinationIndexPath: NSIndexPath, in tableView: UITableView)

func heightForRow(at indexPath: NSIndexPath, in tableView: UITableView) -> CGFloat
func didSelectRow(at indexPath: NSIndexPath, in tableView: UITableView)
...

Short version is, we couldn't find any obvious way to translate delegates, so we punted on it.

···

--
Brent Royal-Gordon
Architechies


(Sean Heber) #5

Yeah, I like that they have a common prefix, but I sort of don’t like how that all looks, either. What if they were grouped first by the fact that they are delegates?

func dataSource(tableview: UITableView, numberOfRowsInSection section: Int) -> Int
func delegate(tableview: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat

(or something).

Not sure if that’d be any better.

l8r
Sean

···

On Jun 27, 2016, at 3:36 PM, Dennis Lysenko via swift-evolution <swift-evolution@swift.org> wrote:

FWIW, I rely on typing `tableView` and looking at the autocompletions to find delegate methods.

Not that that makes this a bad idea, and I'm not sure how many other developers do that (although I imagine quite a few do). Just food for thought.

On Mon, Jun 27, 2016 at 11:44 AM Saagar Jha via swift-evolution <swift-evolution@swift.org> wrote:
I believe that renaming of Apple’s frameworks is not in the scope of swift-evolution; I think you’re supposed to file a radar.

On Mon, Jun 27, 2016 at 9:54 AM Jerome ALVES via swift-evolution <swift-evolution@swift.org> wrote:
Hi everyone,

I can't find anything about Cocoa Delegate/Datasource protocol "Grand Renaming" for Swift 3
Is something planned about this ?

Because I find that actual names don't fit with Swift 3 API guidelines.

For instance :

func numberOfSectionsInTableView(_ tableView: UITableView) -> Int
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
func tableView(_ tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
func tableView(_ tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath)

func tableView(_ tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
func tableView(_ tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
...

could be renamed to something like this :

func numberOfSections(in tableView: UITableView) -> Int
func numberOfRows(inSection section: Int, in tableView: UITableView) -> Int
func cellForRow(at indexPath: NSIndexPath, in tableView: UITableView) -> UITableViewCell
func moveRow(at sourceIndexPath: NSIndexPath, to destinationIndexPath: NSIndexPath, in tableView: UITableView)

func heightForRow(at indexPath: NSIndexPath, in tableView: UITableView) -> CGFloat
func didSelectRow(at indexPath: NSIndexPath, in tableView: UITableView)
...

Kind regards,

Jérôme Alves
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
--
-Saagar Jha
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution