Perfect-CRUD icon indicating copy to clipboard operation
Perfect-CRUD copied to clipboard

Investigate optional property comparison operators.

Open kjessup opened this issue 7 years ago • 0 comments

struct Foo {
let d: Double?
}

…where(\Foo.d < 5.0)…

The above gives a compilation error. Work around is:

…where(\Foo.d! < 5.0)…

While Swift won't technically let you do a comparison with an unwrapped optional:

var d: Double? = 4.0
d < 5.0
error: repl.swift:5:3: error: binary operator '<' cannot be applied to operands of type 'Double?' and 'Double'
d < 5.0
~ ^ ~~~

it's ok in SQL. Look into making this work without the "force unwrap" of the property. (It's not actually force unwrapping.)

kjessup avatar May 20 '18 15:05 kjessup