Skip to content

Commit

Permalink
Merge pull request #133 from drmohundro/version-4.0-changes
Browse files Browse the repository at this point in the history
Begin work on version 4.0 API changes
  • Loading branch information
drmohundro authored Jun 1, 2017
2 parents 4be94ca + 31435da commit 86e2d0a
Show file tree
Hide file tree
Showing 10 changed files with 276 additions and 242 deletions.
22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@ matrix:
language: generic
install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
- script:
- swift build
- swift test
env:
- JOB=Linux
- SWIFT_VERSION=3.1
sudo: required
dist: trusty
language: generic
install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
- script:
- swift build
- swift test
env:
- JOB=Linux
- SWIFT_VERSION=4.0-DEVELOPMENT-SNAPSHOT-2017-05-29-a
sudo: required
dist: trusty
language: generic
install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
after_success:
- gem install slather
- slather
Expand Down
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,6 @@ for elem in xml["root"]["catalog"]["book"].all {
}
```

Alternatively, XMLIndexer provides `for-in` support directly from the index (no `all` needed in this case).

```swift
for elem in xml["root"]["catalog"]["book"] {
print(elem["genre"].element!.text!)
}
```

### Returning All Child Elements At Current Level

Given:
Expand Down Expand Up @@ -280,9 +272,9 @@ __Or__ using the existing indexing functionality:

```swift
switch xml["root"]["what"]["header"]["foo"] {
case .Element(let elem):
case .element(let elem):
// everything is good, code away!
case .XMLError(let error):
case .xmlError(let error):
// error is an IndexingError instance that you can deal with
}
```
Expand Down Expand Up @@ -404,15 +396,15 @@ See below for the code snippet to get this to work and note in particular the `p
extension NSDate: XMLElementDeserializable {
public static func deserialize(_ element: XMLElement) throws -> Self {
guard let dateAsString = element.text else {
throw XMLDeserializationError.NodeHasNoValue
throw XMLDeserializationError.nodeHasNoValue
}

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss zzz"
let date = dateFormatter.dateFromString(dateAsString)

guard let validDate = date else {
throw XMLDeserializationError.TypeConversionFailed(type: "Date", element: element)
throw XMLDeserializationError.typeConversionFailed(type: "Date", element: element)
}

// NOTE THIS
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ end
desc 'Clean, build and test SWXMLHash'
task :test do |_t|
# xctool_build_cmd = './scripts/build.sh'
xcode_build_cmd = 'xcodebuild -workspace SWXMLHash.xcworkspace -scheme "SWXMLHash iOS" -destination "OS=10.2,name=iPhone 6S" clean build test -sdk iphonesimulator | xcpretty'
xcode_build_cmd = 'xcodebuild -workspace SWXMLHash.xcworkspace -scheme "SWXMLHash iOS" -destination "OS=10.3,name=iPhone 6S" clean build test -sdk iphonesimulator | xcpretty'

#if system('which xctool')
#run xctool_build_cmd
Expand Down
2 changes: 1 addition & 1 deletion Scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -ev

#xctool -scheme "SWXMLHash iOS" clean build test -sdk iphonesimulator
set -o pipefail && xcodebuild -workspace SWXMLHash.xcworkspace -scheme "SWXMLHash iOS" -destination "OS=10.0,name=iPhone 6S" clean build test -sdk iphonesimulator | xcpretty
set -o pipefail && xcodebuild -workspace SWXMLHash.xcworkspace -scheme "SWXMLHash iOS" -destination "OS=10.3,name=iPhone 6S" clean build test -sdk iphonesimulator | xcpretty
Loading

0 comments on commit 86e2d0a

Please sign in to comment.