https://kotlinlang.org logo
#arrow
Title
# arrow
d

dave08

02/28/2023, 1:43 PM
Does Optics have a shortcut to modify a value using the object itself (or similar to kotlin's generated copy)?
w

Wilerson Oliveira

02/28/2023, 1:58 PM
Copy code
myObject.copy {
  MyClass.attribute1.transform { "$it-transformed" }
}
d

dave08

02/28/2023, 2:08 PM
I just discovered that there's also an infix
set
! Thanks!
I wonder what the difference is..
Oh... it's to get the old value and transform it, nice!
2 Views