Skip to content

implementation for NSURLComponents.copy(with:) #461

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
merged 1 commit into from
Aug 24, 2016

Conversation

mbvreddy
Copy link
Contributor

This PR has following:

  1. Implementation for NSURLComponents.copy(with:). Approach is to create default NSURLComponent and update fields one by one.
  2. Override isEqual() function. Since copy is not 'self', it is required to override isEqual to compare properties instead of object references.
  3. Unit test for copy(). I've used NSURLComponents class in testcase instead of URLComponents structure because it doesn't have mapping for copy() function.

return true
}
return false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

CFURLComponentsRef implements an equality checking function. Can we just use CFEqual?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to use it. But, couldn't figure out how to cast CFURLComponentsRef to CFTypeRef thay CFEqual expect. NSURLComponent doesn't support toll-free bridge.

Copy link
Contributor

Choose a reason for hiding this comment

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

NSURLComponents is a has-a not an is-a class so for subclasses this approach is by far safer imho

@mbvreddy
Copy link
Contributor Author

rebased

@parkera
Copy link
Contributor

parkera commented Aug 24, 2016

@swift-ci please test linux

@CodaFi
Copy link
Contributor

CodaFi commented Aug 24, 2016

#590 Fixed at least one of these failures

@swift-ci please test Linux.

@parkera parkera merged commit 099f97a into swiftlang:master Aug 24, 2016
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.

4 participants