[swift-evolution] [Review] SE-0005 Better Translation of Objective-C APIs Into Swift

Jacob Bandes-Storch jtbandes at gmail.com
Tue Jan 26 16:53:44 CST 2016

On Tue, Jan 26, 2016 at 1:57 PM, Dave Abrahams via swift-evolution <
swift-evolution at swift.org> wrote:

  $ git grep -nHE -e 'func [a-z]*ing\>\(\)' | grep -v 'string()'
>   ../../Platforms/OSX/DiscRecording.swift:678:  func encoding() -> UInt
>   ../../Platforms/OSX/Quartz.swift:1822:  func mirroring() -> Bool
>   ../../Platforms/OSX/SceneKit.swift:4762:  class func spring() ->
> SCNPhysicsField
>   ../../Platforms/OSX/WebKit.swift:340:  func padding() -> String!
>   ../../Platforms/iOS/SceneKit.swift:4474:  class func spring() ->
> SCNPhysicsField
>   ../../Platforms/iOS/UIKit.swift:2237:  func reversing() -> UIBezierPath
>   ../../Platforms/tvOS/SceneKit.swift:4474:  class func spring() ->
> SCNPhysicsField
>   ../../Platforms/tvOS/UIKit.swift:1723:  func reversing() -> UIBezierPath
>   ../../Platforms/watchOS/UIKit.swift:424:  func reversing() ->
> UIBezierPath
> Except for reversing, these are all fine AFAICT.

Here are some others from the swift-3 branch; I'm not sure where these
currently fall under the guidelines:

  func byCompositingOverImage(dest: CIImage) -> CIImage
  func byCroppingTo(rect: CGRect) -> CIImage
  func byClampingToExtent() -> CIImage

  func removingLastIndex() -> IndexPath

  func generatingNormalMap() -> Self
  func generatingNormalMapWithSmoothness(smoothness: CGFloat, contrast:
CGFloat) -> Self

>     class func *darkGray*() -> UIColor
> >
> > I would rather see this imported as `class var *DarkGray*: UIColor { get
> }`.
> Why should we capitalize some vars and not others?

I was hoping that colors, and other such types with class methods returning
particular instances, would be treated like enum cases.

enum UIColor {
    case DarkGray
    case Black
    case Clear

enum CAMediaTimingFunction {  // more of a job for an overlay, since these
are created with init(name: String)
    case Linear
    case EaseInEaseOut

In the meantime, of course, I saw there was some discussion of having enum
cases begin with lowercase letters as well. I could get used to that. (I'd
just like these to be consistent.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160126/dbc987ec/attachment-0001.html>

More information about the swift-evolution mailing list