I have a set of javascript methods that I plan to place under some group(s) so that a group name (basically an enum case) can represent one or more related methods. This is to avoid having a single method that do have lots of if-else to check for each javascript method being called from bridge into native iOS end. For example:
swift methodGroup{
case G1 = "M1, M2, M3, M4" //Group G1 has a set of method names in a single string
case G2 = "M5, M6, M7, M8,M9" //Group G2 has a set of method names in a single string
.
.
.
}
For each case (or Group) above, there will be a swift class that will be handling the respective javascript methods in the group.
In order to accomplish this, I would like to use the protocol based implementation but not able to figure out how to map various methods of a group to a particular swift class to handle it. Also this class needs to work in both directions meaning able to process javascript calls as received from bridge and also to make calls to the javascript method from native iOS end.
I have a set of javascript methods that I plan to place under some group(s) so that a group name (basically an enum case) can represent one or more related methods. This is to avoid having a single method that do have lots of if-else to check for each javascript method being called from bridge into native iOS end. For example: swift methodGroup{ case G1 = "M1, M2, M3, M4" //Group G1 has a set of method names in a single string case G2 = "M5, M6, M7, M8,M9" //Group G2 has a set of method names in a single string . . . } For each case (or Group) above, there will be a swift class that will be handling the respective javascript methods in the group. In order to accomplish this, I would like to use the protocol based implementation but not able to figure out how to map various methods of a group to a particular swift class to handle it. Also this class needs to work in both directions meaning able to process javascript calls as received from bridge and also to make calls to the javascript method from native iOS end.
Thanks