alexeyxo/protobuf-swift

Optional binding on non-optional

Ramshandilya opened this issue · 3 comments

guard let keyFromFields = String(keyFields) else {

keyFields is of type String. So guard statement breaks, since the result is not an optional.

I think this is my Xcode 9 complaining in Swift 4.0 project?
Shouldn't swift 4.0 & 3.2 co-exist?

Xcode9 run failed in my project

Upgrade to the latest protobuf swift.
brew upgrade protobuf-swift

and I also did:
brew upgrade protobuf

and make sure to use the new swift4 branch:
pod 'ProtocolBuffers-Swift', :git => 'https://github.com/alexeyxo/protobuf-swift.git', :branch => 'swift4'

That's what fixed it for me. After regenerating the swift file from my .proto file and doing a pod install