-
Notifications
You must be signed in to change notification settings - Fork 1.2k
NSData: Align methods with Darwin #1287
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
Conversation
- Remove 'convenience' from: init() init(bytes:length:) init(bytesNoCopy:length:) init(bytesNoCopy:length:freeWhenDone:) init(bytesNoCopy:length:deallocator:) init(contentsOfFile:options:) init?(contentsOfFile:) init(data:) init(contentsOf:,options:) init?(base64Encoded base64String:options:) init?(base64Encoded base64Data:options:) - Add: init?(contentsOf:) (deprecated) base64Encoding() - Add (unimplemented): (deprecated) init?(contentsOfMappedFile:) (deprecated) class func dataWithContentsOfMappedFile() contains() contains(where:) NSMutableData: - Remove 'convenience' from: init?(capacity:) init?(length:) - Add: init(bytes:length:) - Add description documentation to public methods. - Update tests.
@swift-ci please test |
Foundation/NSData.swift
Outdated
@available(*, deprecated) | ||
/// Initializes a data object with the contents of the mapped file specified by a given path. | ||
public init?(contentsOfMappedFile path: String) { | ||
NSUnimplemented() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We intentionally left out deprecated API from swift-corelibs-foundation.
@swift-ci please test |
1 similar comment
@swift-ci please test |
This looks good to me. @spevans are you happy? |
@ianpartridge Yes I think this is ok to go now |
@parkera any more thoughts on this? i've gone through it and compared with the docs, it looks good to me. |
Foundation/NSData.swift
Outdated
/// Returns a Boolean value indicating whether the sequence contains the given element. | ||
func contains(_ element: UInt8) -> Bool { | ||
NSUnimplemented() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did contains and contains(where) come from? As far as I know NSData doesn't conform to Sequence (struct Data does).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I based the missing methods on this documentation:
https://developer.apple.com/documentation/foundation/nsdata
Which has the 2 contains methods. Maybe the documentation is incorrect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see them in the generated interface for NSData
on Darwin. I'll file a bug for the documentation.
@swift-ci please test |
@parkera I removed the two |
Nope, thanks! |
@swift-ci please test and merge |
Remove 'convenience' from:
init()
init(bytes:length:)
init(bytesNoCopy:length:)
init(bytesNoCopy:length:freeWhenDone:)
init(bytesNoCopy:length:deallocator:)
init(contentsOfFile:options:)
init?(contentsOfFile:)
init(data:)
init(contentsOf:,options:)
init?(base64Encoded base64String:options:)
init?(base64Encoded base64Data:options:)
Add:
init?(contentsOf:)
(deprecated) base64Encoding()
Add (unimplemented):
(deprecated) init?(contentsOfMappedFile:)
(deprecated) class func dataWithContentsOfMappedFile()
contains()
contains(where:)
NSMutableData:
Remove 'convenience' from:
init?(capacity:)
init?(length:)
Add:
init(bytes:length:)
Add description documentation to public methods.
Update tests.