hi there im making a photo viewer app in swift using swift 1.1 in xcode 6.2
i am a having trouble trying to convert json response from alamofire to swift objects.i have used swiftyjson library but it seems there is a compatibility issues.here is my model class
import Foundation
struct Photo {
var name: String
var filename :String
var notes: String
}
here is my viewController
import UIKit
class ImageViewerTableViewController: UITableViewController {
var photos = [Photo]()
override func viewDidLoad() {
super.viewDidLoad()
Alamofire.request(.GET, "http://httpbin.org/get")
.responseJSON { (_, _, JSON, _) in
}
}
how can i map json to swift objects in this situation
thanks .
You can use
dataUsingEncoding
method, and get yourname,filename
andnotes
variables fromjson
object, and for parsing json object i recommend SwiftyJSON