Post

Replies

Boosts

Views

Activity

Reply to GeometryReader's size is 0 when enclosed inside NavigationView
So is there any elegant way to find out if it's being evaluated the second time? Actually I have drawn a grid in that method, so I have used range loop to draw it. It crashes the view because of those 0s. I saw a similar post on stackoverflow and it mentions what you have mentioned too. swift private func draw_lines_of_quadrant(screen_width: CGFloat, screen_height: CGFloat) - some View { Path { path in /* Horizontal lines along x-axis */ for y_coord in Int(m_y_space_offset)..Int(screen_height) { /* This coordinate should not exceed the input width */ if y_coord Int(screen_height) && y_coord % Int(m_x_space_offset) == 0 { path.move(to: CGPoint(x: m_x_space_offset, y: max(m_y_space_offset, CGFloat(y_coord) - m_y_space_offset))) path.addLine(to: CGPoint(x: screen_width - m_x_space_offset, y: max(m_y_space_offset, CGFloat(y_coord) - m_y_space_offset))) } } /* Vertical lines along y-axis */ for x_coord in Int(m_x_space_offset)..Int(screen_width) { if x_coord (Int(screen_width) - Int(m_x_space_offset)) && x_coord % Int(m_y_space_offset) == 0 { path.move(to: CGPoint(x: CGFloat(x_coord), y: m_y_space_offset)) path.addLine(to: CGPoint(x: CGFloat(x_coord), y: max(0, screen_height - m_y_space_offset))) } } } .stroke(Color.black, lineWidth: m_stroke_width) .colorInvert() } Thanks for replying.
May ’21