-
Notifications
You must be signed in to change notification settings - Fork 205
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
Begin work on version 4.0 API changes #133
Conversation
Per issue #132, XMLElement can't be nil because of how the reduce implementation works. Instead, it will be an empty string. I think this makes more sense than allowing for nils anyway. A lot of the suggestions mentioned on issue #84 are related to reducing the number of nil checks as well, so this should help alleviate some of that.
Codecov Report
@@ Coverage Diff @@
## master #133 +/- ##
========================================
- Coverage 27.73% 26% -1.74%
========================================
Files 13 13
Lines 1900 1919 +19
========================================
- Hits 527 499 -28
- Misses 1373 1420 +47
Continue to review full report at Codecov.
|
The `attributes` property has been deprecated for a while, so 4.0 will now remove this property in lieu of `attributes(by: name)` or `allAttributes`.
FYI, we found that Swift 4.0 is introducing breaking changes affecting to SWXMLHash and filed SR-4951. |
@norio-nomura thanks for the heads up - I'll start watching that issue, but can plan to rename |
This supports building with `swift-4.0-DEVELOPMENT-SNAPSHOT-2017-05-17-a`
Just an |
Yeah, I think lower case makes sense - I think I had intended to follow Swift conventions, but most of the things I'm seeing now are lowercase so that makes the most sense to me right now. |
I have a branch that changes enums to lowercase for building with Swift 4. |
Nice! I guess the only thing that would have to change before merging it into the 4.0 branch would be the |
[4.0] Lower case enums and better Swift 4 compatibility
The recommended naming for enums is camel case so this commit changes the XMLDeserializationError cases to be named properly. In addition, Sequence was removed from XMLIndexer so-as to avoid a conflict between XMLIndexer.element and Sequence.element in Swift 4 - enumerating over results is still possible by using the `.all` method, though.
Source/SWXMLHash.swift
Outdated
|
||
// swiftlint:disable identifier_name | ||
// unavailable | ||
#if !swift(>=3.2) // `Sequence.Element` is added on Swift 4.0 including with `-swift-version 3` |
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.
This #if
is no longer needed, since it is no longer Sequence
.
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.
Fixed this in #138
This fixes attributes tests on Linux.
- `LazyWhiteSpaceParsingTests.testShouldBeAbleToCorrectlyParseCDATASectionsWithWhitespace` - `WhiteSpaceParsingTests.testShouldBeAbleToCorrectlyParseCDATASectionsWithWhitespace`
This is no longer needed since `XMLIndexer` is no longer `Sequence`.
Run tests on linux
This is to track the initial work on #84 - I'm not positive how many new features will make this release, but I'd definitely like to clean up some of the nil checks (whether by allowing defaults or some other means).
I'd welcome any additional PRs to this branch if others would like to see additional changes make it for the 4.0 release.