react-meets-swiftui icon indicating copy to clipboard operation
react-meets-swiftui copied to clipboard

Use conditional binding

Open mbuchetics opened this issue 5 years ago • 3 comments

It's better to you optional binding (https://docs.swift.org/swift-book/LanguageGuide/TheBasics.html) instead of checking for nil and then force unwrapping.

mbuchetics avatar Jul 15 '19 10:07 mbuchetics

I somehow totally missed this. Thanks for the PR. This is good advice.

bmcmahen avatar Aug 16 '19 19:08 bmcmahen

For some reason I didn't think optional binding actually worked in this context... Is this something new in a later version of SwiftUI? I haven't actually touched the last few betas

bmcmahen avatar Aug 16 '19 19:08 bmcmahen

You may be right. Haven’t tried the latest betas myself. I assumed that if the nil check worked, the unwrapping would work as well.

mbuchetics avatar Aug 17 '19 04:08 mbuchetics