objcio / thinking-in-swiftui-sample-code

Sample code for the Thinking in SwiftUI book
https://www.objc.io/books/thinking-in-swiftui
MIT License
333 stars 37 forks source link

Chapter 5 solution with .matchedGeometryEffect #6

Open borisyurkevich opened 4 years ago

borisyurkevich commented 4 years ago

Hello.

“Just as the tab bar example earlier in this chapter, the animating selection rectangle can be implemented “by hand” or using SwiftUI’s new matched geometry effect. It’s worthwhile to try implenting it both ways!”

Excerpt From: Chris Eidhof. “Thinking in SwiftUI”. Apple Books.

As am struggling with the second way, I was looking into the Exercises/Chapter 05/Selectable Tables/Selectable Tables/ContentView.swift in hope to find a version which uses the .matchedGeometryEffect. Does it work for you for the cell selection and can you share the solution please?

By the way, implenting is your typo. 🙂

chriseidhof commented 3 years ago

Hi @borisyurkevich ! Thanks for asking. Here's the code: https://github.com/objcio/thinking-in-swiftui-sample-code/blob/swiftui2/Chapter%2005/TabView2/TabView/ContentView.swift (it's in the swiftui2 branch, not on master yet).

Thanks for letting us know about the typo, it seems to have been fixed already.