on Fri Oct 14 2016, William Sumner <swift-evolution@swift.org> wrote:
>> On Oct 14, 2016, at 8:49 AM, Adrian Zubarev via swift-evolution >> <swift-evolution@swift.org> wrote: >> >> I’m still not convinced in some cases. >> > >> Take a look at UIViews and its method addSubview. >> >> open func addSubview(_ view: UIView) >> Personally I’d change or write this function like so: >> >> open func add(subview: UIView) >> This reduces unnecessary noise _ view for both the implementation and usage. >> >> // Implementation >> open func add(subview: UIView) { >> // `subview` is descriptive and just fine here >> } >> >> // Usage >> >> self.view.add(subview: someOtherView) >> >> >> >> -- >> Adrian Zubarev >> Sent with Airmail > > This conforms to the following rule from the Argument Labels section of the > naming guidelines: > > “[I]f the first argument forms part of a grammatical phrase, omit its > label, appending any preceding words to the base name, > e.g. x.addSubview(y)" Actually, by itself that rule would allow self.view.add(someOtherView) But we don't do that because views aren't collections; they *have* collections. -- -Dave _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution