Skip to content

Stub out new properties/enum in URLSessionConfiguration #1217

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

Merged

Conversation

pushkarnk
Copy link
Member

New properties per the API doc. Though they may be irrelevant in the Linux server context, they may make sense in the Android context.

@pushkarnk
Copy link
Member Author

@johnno1962 The two new properties in URLSessionConfiguration waitForConnectivity and multipathServiceType are possibly irrelevant to the Linux server context. Do you see them being implemented in the near future for Swift Foundation on Android though?

@johnno1962
Copy link
Contributor

Hi, this might be useful in future but for now I can’t think of a way to implement this from the NDK.

@pushkarnk
Copy link
Member Author

@parkera Can you please let us know your opinion on this?

@parkera
Copy link
Contributor

parkera commented Oct 9, 2017

@salgernon could also chime in here, but -- it seems that if we have no way to reasonably implement this, we may be better off either leaving these out or marking them unavailable to warn developers that there is no implementation.

@parkera
Copy link
Contributor

parkera commented Oct 9, 2017

This one falls into the category of "leafy" API that doesn't need to be implemented with NSUnimplemented.

@alblue
Copy link
Contributor

alblue commented Oct 10, 2017

If we think these aren't going to be implemented any time soon, we could use NSUnsupported() and an availability macro to indicate that it's deprecated/unavailable on non-Darwin platforms, as we did in:

https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/Bundle.swift#L80

That way we allow those coding against it to know that these aren't available and will generate a compile error/warning, rather than relying on the behaviour and wondering why it doesn't work.

Of course if we do think this will be implemented in the near future then NSUnimplemented may be better.

@ianpartridge
Copy link
Contributor

I agree that NSUnsupported() seems the best choice here.

@@ -209,4 +209,19 @@ open class URLSessionConfiguration : NSObject, NSCopying {
*/
open var protocolClasses: [AnyClass]?

/* A Boolean value that indicates whether the session should wait for connectivity to become available, or fail immediately */
open var waitsForConnectivity: Bool = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should have a warning:

@available(*,deprecated,message:"Not available on non-Darwin platforms")

open var multipathServiceType: URLSessionConfiguration.MultipathServiceType = .none

}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a warning:

@available(*,deprecated,message:"Not available on non-Darwin platforms")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also use unavailable to make it an error to attempt to use it.

@pushkarnk pushkarnk force-pushed the urlconfiguration-new-properties branch from 93753d9 to 25561b4 Compare October 11, 2017 19:37
@pushkarnk
Copy link
Member Author

Thanks @parkera @alblue and @ianpartridge for reviewing! I agree with all the points made above and have made changes suitably.

@ianpartridge
Copy link
Contributor

@swift-ci please test and merge

@swift-ci swift-ci merged commit 57fb8d2 into swiftlang:master Oct 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants