ShawnFoo / SwiftWebViewBridge

Swift version of WebViewJavascriptBridge with more simplified and friendly methods to handle messages between Swift and JS in UIWebViews
MIT License
137 stars 34 forks source link

Force to set a defaultMessageHandler #3

Closed libern closed 8 years ago

libern commented 8 years ago

Request to have a set on defaultMessageHandler

when a name of handler is not exists in the handlers dictionary, we can simply call the default handler instead of through fatal error

ShawnFoo commented 8 years ago

The point to throw fatalError is to help you to debug that defaultHandler is missed. I think there is no need to force others to set a defalutMessageHandler because not everyone will use that. That's why is optional. What do you think?

libern commented 8 years ago

You should notice about version changes when lower version app that with only e.g. 2 handlers.

However, you add one more handler in a new version, there are 3 handlers.

It is good that we need to add more handlers to handle the callback.

When this page is loaded in older version app, it will cause the fatal error, i.e. app crashes.