// simple data representation
public class Item {
var Id: Int?
var Name: String?
}
// field enumerator
public enum Field : String {
case Id, Name
}
// json as dictionary representation
let arr:[String:Any] = ["Id": 1, "Name": "Record #1"]
// link dictionary and enum
let map = Map.link(arr, and: Field.self)
// create data object
let data = Item()
// set value
data.Id <- map[.Id]
data.Name <- map[.Name]-
Notifications
You must be signed in to change notification settings - Fork 0
andrejs-mamontovs/MapToEnum
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
Map key/value to object
Topics
Resources
Stars
Watchers
Forks
Packages 0
No packages published