You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
517 B
24 lines
517 B
//
|
|
// ExtensionJSON.swift
|
|
// GMERemittance
|
|
//
|
|
// Created by gme_2 on 22/08/2018.
|
|
// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import SwiftyJSON
|
|
import ObjectMapper
|
|
|
|
extension JSON {
|
|
func map<T: Mappable>() -> [T]? {
|
|
let json = self.array
|
|
let mapped: [T]? = json?.compactMap({$0.map()})
|
|
return mapped
|
|
}
|
|
|
|
func map<T: Mappable>() -> T? {
|
|
let obj: T? = Mapper<T>().map(JSONObject: self.object)
|
|
return obj
|
|
}
|
|
}
|