Parse array of String for Realm with ObjectMapper
Response JSON:
{
id: 210,
images: ["image1","image2","image3"]
}
Swift Model file :
public class Value: Object {
@objc public dynamic var image: String?
}
class : Object, Mappable {
@objc dynamic var id = 0
var images = List<Value>()
override static func primaryKey() -> String? {
return "id"
}
//Impl. of Mappable protocol
required convenience init?(map: Map) {
self.init()
}
func mapping(map: Map) {
//Used screenshot because syntax creates problem in editor
//Used screenshot because syntax creates problem in editor
}
}
Fetch images like this :
var imageURLArray = List<Value>()
self.imageURLArray = .images
imageURLArray[indexPath.row].image!
Awesome Article Thanks for sharing your valuable information you can hire an iPhone developer from Technoduce in a flexible manner. Experienced Ios developer of the company to work at your or our place! Hire Iphone Developer
ReplyDelete