uny / XMLDecoder

XMLDecoder for Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

XMLDecoder for Swift

License:MIT License


Languages

Language:Swift 99.3%Language:Objective-C 0.7%