Skip to content

Crash on example (simplified from larger complex project crash) #25

@matthewkrom

Description

@matthewkrom

Following on from previous issue — 3.0.1 did fix the crash I reported — thank you! In the process of trying again in my larger complex project, I developed this additional View which should exhibit a crash as well.

This is not to say that this code exhibits the best practices for layout — it does not. Also, it's a squashing into a single view my complex project example with many views. But, it does crash :)

Happy to help with reporting these! HFlow et al is a very promising layout package.

//
//  ContentView.swift
//  SwiftUIFlowTester
//
//  Created by Matthew Krom on 1/20/25.
//

import SwiftUI
import Flow

struct ContentView: View {
  
  var body: some View {
    
    VStack {
      Text("Flow Testing")
        .font(.title)
      HFlow(alignment: .top) {
        GroupBox {
          VStack(alignment: .leading) {
            Text("A")
          }
        }
        .fixedSize()
        .padding(.bottom)
        .frame(alignment: .topLeading)
        .padding(.horizontal)
        
        GroupBox {
          HStack {
            Text("B")
          }
          
        }
        .frame(
          maxWidth: .infinity,
          maxHeight: .infinity,
          alignment: .topLeading
        )
        .padding(.bottom)
        .padding(.horizontal)
        .fixedSize(horizontal: true, vertical: false)

        
        GroupBox {
          Text("C")
          Text("...")
          Text("...")
          Text("...")
          Text("...")
          Text("...")
        }
        /* The reason we have multiple frame/fixedSize here is that in the real
         project, there are subviews (container views) which provide these
         .frame modifiers — we don't have them all in one place, if you see what I mean. */
        .frame(
          maxWidth: .infinity,
          maxHeight: .infinity,
          alignment: .topLeading
        )
        .padding(.bottom)
        .padding(.horizontal)
        .fixedSize(horizontal: true, vertical: false)

      }
    }
    .frame(maxWidth: .infinity)
  }
}

#Preview {
  ContentView()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions