Closed terasupernova closed 7 years ago
hey @terasupernova Unfortunately generics will not work since this library uses objc runtime APIs. you could create a wrapper around it though, something like:
func providePaginatedData<T>(type: T, dictionary: [String: AnyObject]) -> PaginationListModel<T> {
let model = PaginationListModel<T>()
model.data = ObjectMapper.sharedInstance().objectFromSource(dictionary, toInstanceOfClass: T) as! [T]
return model
}
haven't tested or compiled the code so there may be errors in it, let me know if it makes sense LEt me know if this works
Hi, @aryaxt. It works, thank you very much.
Hi, i want to use generic in class. But i dun know how to get it.
When i print "data", the result is nil. If i replace
var data:[T]!
tovar data:[BrandSimpleWebModel]!
then i can get the data. Please help me. Thank you