Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
matthewkrom opened this issue Jan 20, 2025 · 1 comment
Open

Comments

@matthewkrom
Copy link

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()
}
@matthewkrom
Copy link
Author

I should add that this crash appears different from the previous one — instead of the stack trace pointing to your package, it points to @main . But, replacing HFlow with HStack "fixes" the issue, so it seems the issue may be introduced by HFlow

Image Image

@matthewkrom matthewkrom changed the title Crash on contrived example (simplified from larger complex project crash) Crash on example (simplified from larger complex project crash) Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant