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

Allows to escape SWVBResponseCallBack #10

Closed sylvainlaurent closed 7 years ago

sylvainlaurent commented 7 years ago

When some JS calls my Swift handler with a SWVBResponseCallBack, I want to use this callback after an async call returns. But the Swift compiler complains about "Closure use of non-escaping parameter...."

Therefore I propose to have SWVBHandler declared like this:

public typealias SWVBHandler = (AnyObject, @escaping SWVBResponseCallBack) -> Void

instead of

public typealias SWVBHandler = (AnyObject, SWVBResponseCallBack) -> Void
ShawnFoo commented 7 years ago

Thanks, Good point!