Quick KeyPath Editting
/*
class SomeObject {
var value = ""
}
*/
let someValue = SomeObject()
print(someValue.value) // Output: ""
/*
(ObjectForKeyPath) + (KeyPath) - (ValueOfKeyPath)
*/
someValue + \.value - "Hello World"
print(someValue.value) // Output: "Hello World"
error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions dumb + .string - "Hello!" + .double - 3.14 + .array - [1, 43, 6, true] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
Make sure to use parentheses!
var dumb = DumbStruct()
(((dumb + \.string - "Hello!")
+ \.double - 3.14)
+ \.array - [1, 43, 6, true])
XCTAssertEqual(dumb.string, "Hello, World!")