Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 1000 Bytes

README.md

File metadata and controls

41 lines (32 loc) · 1000 Bytes

XMLDecoder

Build Status Carthage compatible Codecov

XMLDecoder for Swift.

Requirements

  • iOS 8.0+
  • Xcode 9.0+
  • Swift 4.0+

Installation

Carthage

To integrate XMLDecoder into your Xcode project using Carthage, specify it in your Cartfile:

github "uny/XMLDecoder"

Usage

You can use XMLDecoder like JSONDecoder:

struct Object {
  let string: String
  let int: Int
}

let data = "<root><string>string</string><int>100</int></root>".data(using: .utf8)!
let decoder = XMLDecoder()
do {
  let object = try decoder.decode(Object.self, from: data)
  print(object)
} catch let error {
  // ...
}

XMLDecoder currently does not support attributes.