Created
February 6, 2020 13:17
-
-
Save Thomvis/cf4d492ee7352d64825bc3d5767d15d2 to your computer and use it in GitHub Desktop.
Revisions
-
Thomvis created this gist
Feb 6, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ content .onPreferenceChange(SizeKey.self, perform: { sizes in // this is not always called }) .overlayPreferenceValue(SizeKey.self) { sizes in EmptyView().onAppear { // this is called more reliably // the view's id controls for which changes this is called }.id(sizes.map { $0.width*1000+$0.height }) }