Guo Li created CB-13509:
---------------------------
Summary: Need to add nullibility support for method
CDVWebViewEngineProtocol.evaluateJavaScript
Key: CB-13509
URL: https://issues.apache.org/jira/browse/CB-13509
Project: Apache Cordova
Issue Type: Bug
Components: cordova-ios
Environment: Xcode 9
Reporter: Guo Li
Assignee: Suraj Pindoria
In our project, we consume cordova as framework and want to use
CDVWebViewEngineProtocol in swift code.
After compiling the generated interface of an Objective C object
CDVWebViewEngineProtocol are translated into following.
{code:swift}
public protocol CDVWebViewEngineProtocol : NSObjectProtocol {
@available(iOS 2.0, *)
public var engineWebView: UIView! { get }
public func load(_ request: URLRequest!) -> Any!
public func loadHTMLString(_ string: String!, baseURL: URL!) -> Any!
public func evaluateJavaScript(_ javaScriptString: String!,
completionHandler: ((Any?, Error?) -> Swift.Void)!)
public func url() -> URL!
public func canLoad(_ request: URLRequest!) -> Bool
public init!(frame: CGRect)
public func update(withInfo info: [AnyHashable : Any]!)
}
{code}
Currently method evaluateJavaScript do not support nullibility paramaters
{code:swift}
public func evaluateJavaScript(_ javaScriptString: String!,
completionHandler: ((Any?, Error?) -> Swift.Void)!)
{code}
Thus we have to either use the same signature or manual check for nil in our
implementation. We finally pick the 2nd option as solution since we don't want
to include any '!' in our swift code. But this is not a very adorable practice
since we can not match the method exactly as the same method in the protocal.
To avoid this issue, it would be great to add nullibility support for method
CDVWebViewEngineProtocol.evaluateJavaScript.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]