Swift API Design Guide (https://swift.org/documentation/api-design-guidelines) says :
The first argument to initializer and factory methods calls should not form a phrase starting with the base nameSpecially, it advises us against writing things like :
let foreground = Color(havingRGBValuesRed: 32, green: 64, andBlue: 128)
let newPart = factory.makeWidget(havingGearCount: 42, andSpindleCount: 14)
let ref = Link(to: destination)But in UIKit or in Foundation, we find code like :
struc Array<T> {
// ...
init(repeating repeatedValue: Array.Element, count: Int)
}
class UIImage {
// ...
init?(
named name: String,
in bundle: Bundle?,
compatibleWith traitCollection: UITraitCollection?
)
}Is it correct ?