v3.0 suggestion 😉 #88
Replies: 7 comments 4 replies
-
I found that v3.0 is a bit strange display on the ipad or mac. Its width is too small, causing some content to be squeezed and not displayed completely. I think it would be better to set the width to half the screen width, just like SwiftUI's |
Beta Was this translation helpful? Give feedback.
-
Hello @kylechandev, Next, as you can see, I changed this issue into a discussion, because I think this is the right place to discuss the suggested feedback and changes. So lets start with your suggestions: Regarding 1⃣:I removed the old Could you please send a screenshot or explain what you mean by:
Attaching the shadow to the background set via Regarding 2⃣:Do you have flick through enabled? If so, is flick through also hard to trigger? Regarding 3⃣:Im not quite sure if I understand your problem correctly. Did you use version 2 before you started using version 3? How did your code look in version 2? Was your code better/cleaner in version 2? Regarding your comment:I tried to mimic apple apples BottomSheet (as seen in Maps) and not the one apple added in iOS 16. And I think it is a great match: However if you don't want to use my BottomSheet on iPad or Mac you can use a conditional modifier: extension View {
/// Applies the given transform if the given condition evaluates to `true`.
/// - Parameters:
/// - condition: The condition to evaluate.
/// - transform: The transform to apply to the source `View`.
/// - Returns: Either the original `View` or the modified `View` if the condition is `true`.
@ViewBuilder func `if`<Content: View>(_ condition: Bool, transform: (Self) -> Content) -> some View {
if condition {
transform(self)
} else {
self
}
}
} and then use it like this: ContentView()
.navigationTitle("Hello World")
.if(self.shouldApplyBottomSheet) { view in
view
.bottomSheet(...)
.customBackground(...)
// ...
}
.if(self.shouldApplyNormalSheet) { view in
view
.sheet(...)
// ...
}
.accentColor(.red)
// ... |
Beta Was this translation helpful? Give feedback.
-
Hello @lucaszischka, Thank you for the relay 😊 1⃣️ Bottom Sheet shadowIf I add 2⃣️ Swipe to dismissWhether I turn on flick through or not, the result looks the same. I know the swipe trigger is 0.3*sheetHeight, but the problem is that the swipe doesn't seem to follow the hand? This makes it difficult for bottom sheet to trigger 2022-08-10.9.26.26.mov3⃣️ About [BottomSheet+ViewModifiers]Yes, I use Because I will use multiple
The BottomSheet on IPad or MacI think it would be better to have the BottomSheet on the left in the Finally, Thank you for your efforts on BottomSheet! 😉 |
Beta Was this translation helpful? Give feedback.
-
Hey @kylechandev, thank you for your detailed answer!! It helps very much and now I understand every issue you had. Regarding 1⃣️:I will need time to investigate and to come up with a solution. I will tell you when I have an idea or solution. Regarding 2️⃣:I want to mention that is not calculated proportional to the BottomSheet height, but to the screen height. Nevertheless I understand the issue and I will probably add an modifier which can set the threshold. Regarding 3️⃣:I do not see the problem with the new version. I think your extension is a great way of making your code cleaner. struct MyBottomSheet<MContent>: ViewModifer {
@Binding var bottomSheetPosition: BottomSheetPosition
var switchablePositions: [BottomSheetPosition]
var title: String
var mainContent: MContent
var isSwipeToDismissEnabled: Bool
// …
func body(content: Content) -> some View {
content
// You don’t need to add the BottomSheet here
.bottomSheet(bottomSheetPosition: self.$bottomSheetPosition, switchablePositions: self. switchablePositions, title: self.title, content: self.mainContent)
.enableSwipeToDismiss(self.isSwipeToDismissEnabled)
// …
}
}
extension View {
func myBottomSheet<MContent>(…) -> some View {
modifier(MyBottomSheet(…))
}
} Regarding 4️⃣:Thank you for your input. I understand why you think this behavior only makes sense for Map applications or applications where the BottomSheet is always shown. However I don’t think that I will change this behavior, because you still have the option to use a sheet on Mac and iPad and my BottomSheet on iPhone to archive the behavior you expect. |
Beta Was this translation helpful? Give feedback.
-
Hi! |
Beta Was this translation helpful? Give feedback.
-
Here are some news for you @kylechandev. Regarding 1⃣️:This will need to be worked on, but for now you can add the shadow to your For any one reading this: Small fixes and changes will still be done, but fixing/adding shadows is too much work for now. Regarding 2⃣:The threshold can now be changed; please use |
Beta Was this translation helpful? Give feedback.
-
Hi! How can I use with flags (true or false)? |
Beta Was this translation helpful? Give feedback.
-
What amazing awesome work this is!
Thank you very much for your hard work on v3.0 during this time! 😊
I'm already using v3.0 and I'd like to make some suggestions:
1⃣️ Bottom sheet background corner and shadow
In v3.0, support the new
customBackground()
modifier, but I only want to change the background corner like v2.x (Because I wish to preserve the built-in multi-platform compatible blur background effect). The sameshadow
is also. In this demo I found using.shadow
directly to set the sheet shadow, but this causes my entire page to have a shadow as well (which is not expected).2⃣️ [enableSwipeToDismiss] become hard to trigger
In v3.0, you need to swipe down very quickly to close the sheet (still may not dismiss), which in v2.0 there is no problem.
3⃣️ About [BottomSheet+ViewModifiers]
I don't feel this way is very good, because I may show multiple bottom sheets on one page with different behavior, which will make the call chain very long, currently my solution is this:
It's also possible that I'm using it incorrectly...
Finally, thank you for creating this awesome library! I love you!
My English is poor, hope to convey my thoughts... 😝
Beta Was this translation helpful? Give feedback.
All reactions