Skip to content

uny/XMLDecoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.