SheeKit icon indicating copy to clipboard operation
SheeKit copied to clipboard

Feature: Ability to change background color

Open SylarRuby opened this issue 2 years ago • 1 comments

Hey @edudnyk Great package. I'm loving it.

One small thing, is it possible to enable us to have our own background color? The only way to achieve this is by doing:


.shee(isPresented: $isShowingSheet,
              presentationStyle: .formSheet(properties: .init(detents: [ .medium(), .large() ], selectedDetentIdentifier: $selectedDetentIdentifier, animatesSelectedDetentIdentifierChange: true)),
              presentedViewControllerParameters: presentedViewControllerParameters,
              onDismiss: didDismiss) {
            VStack {
                Text("License Agreement")
                    .font(.title)
                    .padding(50)
                Text("""
                        Terms and conditions go here.
                    """)
                    .padding(50)
                Button("Dismiss",
                       action: { isShowingSheet.toggle() })
            }
        }
        // Background color
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .background(Color.gray.edgesIgnoringSafeArea(.all))

SylarRuby avatar Jun 04 '22 12:06 SylarRuby

Hey @SylarRuby, what exactly prevents you from having your own background color, and where? Why you modify the background to the output of .shee(...) and not the VStack itself?

.shee(isPresented: $isShowingSheet,
              presentationStyle: .formSheet(properties: .init(detents: [ .medium(), .large() ], selectedDetentIdentifier: $selectedDetentIdentifier, animatesSelectedDetentIdentifierChange: true)),
              presentedViewControllerParameters: presentedViewControllerParameters,
              onDismiss: didDismiss) {
            VStack {
                Text("License Agreement")
                    .font(.title)
                    .padding(50)
                Text("""
                        Terms and conditions go here.
                    """)
                    .padding(50)
                Button("Dismiss",
                       action: { isShowingSheet.toggle() })
            }
             .background(Color.gray.edgesIgnoringSafeArea(.all))
        }

edudnyk avatar Jan 12 '23 00:01 edudnyk