Skip to content

Instantly share code, notes, and snippets.

View nicohaemhouts's full-sized avatar

Nico Haemhouts nicohaemhouts

  • Sydney, Australia
View GitHub Profile
@nicohaemhouts
nicohaemhouts / _.md
Last active August 29, 2015 14:24
Force Layout with Radial Progress
@nicohaemhouts
nicohaemhouts / _.md
Last active August 29, 2015 14:26
Scrolling line chart
@nicohaemhouts
nicohaemhouts / _.md
Last active August 29, 2015 14:26
Updating Area Chart
@nicohaemhouts
nicohaemhouts / _.md
Last active August 29, 2015 14:27
Random Increasing Line Chart
git tag archive/<your-branch> <your-branch>
git push --tags
git push -d origin <your-branch>
git branch -D <your-branch>
/* Using GeometryReader to find out the width of the parent is problematic when the parent does not have a height and depends on its children to give it height, e.g. VStack, ScrollView, etc GeometryReader takes up all the space it can get but if the parent has no height then GeometryReader will simply not have a height and your view will not render properly. ParentWidthReader uses a widely used workaround using PreferenceKey and a GeometryReader as a background thus bypassing the height problem.
*/
import SwiftUI
struct ParentWidthReader<Content>: View where Content: View {
typealias ContentBuilder = (CGFloat) -> Content
@State var width: CGFloat = .infinity
let content: ContentBuilder