Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Externally named parameters #18

Open
paulrolfe opened this issue Feb 23, 2016 · 1 comment
Open

Externally named parameters #18

paulrolfe opened this issue Feb 23, 2016 · 1 comment

Comments

@paulrolfe
Copy link

When a function takes a parameter that isn't named in the function name, should it be given an external name?

For example, when using this function:

extension UIView {
    func zoom(scale: CGFloat) {
        // the zooming
    }
}

...the call would look like myView.zoom(2.3). My question is should it be made more clear with an externally named parameter and you'd say myView.zoom(toScale: 2.3)?

Or maybe even myView.zoomToScale(2.3) --- I think this is bad and not very swifty here, but in some cases it would work better. As it does in presentViewController()

And can we use this kind of function naming rule universally?

@loganwright
Copy link

This has relevance here, notably the Strive for Fluent Usage section. I think we should seek parity w/ the official design guidelines where possible. I don't see anything concrete one way or the other here, just a general principle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants