More Swift-like initializers and enums in UIKit


(Nick O'Neill) #1

I've been using `UIViewControllerAnimatedTransitioning` recently and the
associated APIs are usable but decidedly not very Swifty. Lots of the main
UIKit APIs got a Swift makeover as we've progressed through releases but
there are still a few such as this one that could use some touching up. I
would love to submit a PR with some improvements to these APIs.

I looked around for a bit but I couldn't find anything in the public repos
- presumably this stuff is tucked in the private UIKit source somewhere.

Did I miss a spot where I can submit a PR for this or is there a chance the
Swift headers for these UIKit APIs could be made open source in the future?

Nick


(Jens Alfke) #2

As with all things Apple that aren’t open source, the answer is “go to bugreport.apple.com and file a request”. :confused:

There are no Swift headers for Objective-C APIs; the Swift API is derived at compile-time by parsing the .h files. Apple’s not going to open-source things like UIKit, even the headers, because the headers reveal all the functionality in the framework. That would impede their ability to work on features in secret and then announce them at WWDC. (Unless they did their work on internal branches … but then merging those on a yearly basis sounds unpleasant!)

For these and other reasons, I think Swift questions relating to UIKit or AppKit or other closed-source Apple frameworks are better addressed on the cocoa-dev mailing list at lists.apple.com.

—Jens

···

On Dec 23, 2015, at 9:03 AM, Nick O'Neill via swift-users <swift-users@swift.org> wrote:

Did I miss a spot where I can submit a PR for this or is there a chance the Swift headers for these UIKit APIs could be made open source in the future?


(Nick O'Neill) #3

Thanks for the feedback Jens,

I understand the concept of deriving the Swift API from the Objective-C
headers (nullability annotations and all...) but I was under the impression
that some of the more Swifty initializers were accomplished with
convenience initializers in small extensions written in Swift.

While I'm not certain that difficulty with git would make this entirely
infeasible, I do see your point about making things a little more difficult
around WWDC time. I'll see what cocoa-dev has to say about it.

Nick

···

On Wed, Dec 23, 2015 at 9:34 AM, Jens Alfke <jens@mooseyard.com> wrote:

On Dec 23, 2015, at 9:03 AM, Nick O'Neill via swift-users < > swift-users@swift.org> wrote:

Did I miss a spot where I can submit a PR for this or is there a chance
the Swift headers for these UIKit APIs could be made open source in the
future?

As with all things Apple that aren’t open source, the answer is “go to
bugreport.apple.com and file a request”. :confused:

There are no Swift headers for Objective-C APIs; the Swift API is derived
at compile-time by parsing the .h files. Apple’s not going to open-source
things like UIKit, even the headers, because the headers reveal all the
functionality in the framework. That would impede their ability to work on
features in secret and then announce them at WWDC. (Unless they did their
work on internal branches … but then merging those on a yearly basis sounds
unpleasant!)

For these and other reasons, I think Swift questions relating to UIKit or
AppKit or other closed-source Apple frameworks are better addressed on the
cocoa-dev mailing list at lists.apple.com.

—Jens