krzyzanowskim / Natalie

Natalie - Storyboard Code Generator (for Swift)
http://blog.krzyzanowskim.com/2015/04/15/natalie-storyboard-code-generator/
MIT License
1.17k stars 74 forks source link

use nil for sender in performSegue as a default value #46

Closed kostiakoval closed 9 years ago

kostiakoval commented 9 years ago

because sender is optional, I think it's nice to be able to skip it when you call performSegue(MainViewController.Segue.ScreenOneSegue)

krzyzanowskim commented 9 years ago

It's like this because standard performSegue is like this and it's good to keep interface compatibility where possible.

kostiakoval commented 9 years ago

I agree with consistency issue. When you declare an optional variable, the nil is assigned by default. I have thought it would be useful to do the same for function. Maybe Apple will change the API later to do the same.

kostiakoval commented 9 years ago

How about this.

The issue I see is that now Xcode don't show the suggestions that there are 2 function (when you use default nil value). So it's a bit unclear when the nil is send implicitly

But if we have 2 functions Xcode will show you them and you can choose which to use. screen shot 2015-06-17 at 11 29 50

krzyzanowskim commented 9 years ago

@kostiakoval I do like the change, however let's wait with this change for iOS9. If Apple update Swift to make it nil, I'd be happy to apply this change. Let's have it drop-in replacement as much as possible.

And I hope Swift guys are working on it already rdar://21437642

kostiakoval commented 9 years ago

ok. Can't find that radar :(

krzyzanowskim commented 9 years ago

nobody can, unless you an Apple employee ;)