I’m going through the part in chapter 14 where we try to animate the flight details by manipulating the offset (page 482 on the epub):
if showDetails {
FlightDetails(flight: flight)
.offset(x: showDetails ? 0 : -UIScreen.main.bounds.width)
}
This won’t actually work because of the if
statement. It will still ad or remove the view based on that condition and ignore any of the animation modifiers added after offset(...)
.
Instead we should remove the if
and just keep:
FlightDetails(flight: flight)
.offset(x: showDetails ? 0 : -UIScreen.main.bounds.width)
Any animation modifiers added after offset(...)
will now work properly.