You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I like to conform MyViewController to MyProtocol as follows. It causes error "Type 'MyViewController' does not conform to protocol 'MyProtocol'" in Swift 5
// code1.swiftclassMyView:UIView{}protocolMyProtocol:AnyObject{varmyView:MyView{get}}// Type 'MyViewController' does not conform to protocol 'MyProtocol'classMyViewController:UIViewController,MyProtocol{@IBOutletvarmyView:MyView!}
If the protocol is written by ourself, we can rewrite as code3, however, if the protocol is provided by third party, then I have take other way such as code2.
I have a feature request that return value of implicitly unwrapped optional value to be treated as none optional value (code1). Or, if swift team come up with better way to solve this problem, then I would be happy.
Thanks,
The text was updated successfully, but these errors were encountered:
var MyView and MyView to be equivalent as long as the implicit unwrap succeeds, but what happens when it doesn’t? The protocol requires conforming types to always provide a valid MyView value but it’s possible for the implicit unwrap to fail and nil is not a valid value.
Additional Detail from JIRA
md5: e437e614ee8163f5a48d4882b4867434
Issue Description:
When I like to conform MyViewController to MyProtocol as follows. It causes error "Type 'MyViewController' does not conform to protocol 'MyProtocol'" in Swift 5
Of course, I have an option to write like this
Or, I can make its accessor to be implicitly unwrapped optionals as this.
If the protocol is written by ourself, we can rewrite as code3, however, if the protocol is provided by third party, then I have take other way such as code2.
I have a feature request that return value of implicitly unwrapped optional value to be treated as none optional value (code1). Or, if swift team come up with better way to solve this problem, then I would be happy.
Thanks,
The text was updated successfully, but these errors were encountered: