-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Issue 22] Fix bottom sheet height for navigation and table controlle…
…rs (#27) * Rename files * Randomize test execution order * New layout properties * Use and test new layout height properties * Add sizing for navigation controller and table views * Don’t layout subviews when appearance changes * Fix bug with clipped corners
- Loading branch information
Mark Pospesel
authored
May 4, 2023
1 parent
9d0424b
commit 7c61299
Showing
19 changed files
with
422 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
Sources/YBottomSheet/BottomSheetController+Appearance+Layout.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// | ||
// BottomSheetController+Appearance+Layout.swift | ||
// YBottomSheet | ||
// | ||
// Created by Dev Karan on 19/01/23. | ||
// Copyright © 2023 Y Media Labs. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension BottomSheetController.Appearance { | ||
/// A collection of layout properties for the `BottomSheetController`. | ||
public struct Layout: Equatable { | ||
/// Corner radius of bottom sheet view. Default is `16`. | ||
public var cornerRadius: CGFloat | ||
|
||
/// Minimum top offset of sheet from safe area top. Default is `44`. | ||
/// | ||
/// The top of the sheet will not move beyond this gap from the top of the safe area. | ||
public var minimumTopOffset: CGFloat | ||
|
||
/// Maximum content height of sheet. | ||
/// | ||
/// Only applicable for resizable sheets. | ||
/// If `nil` a resizable sheet will be allowed to grow until it nearly fills the screen. | ||
/// c.f. `minimumTopOffset` | ||
public var maximumContentHeight: CGFloat? | ||
|
||
/// Ideal content height of sheet. | ||
/// | ||
/// Used to determine the initial size of the sheet. | ||
/// If `nil`, the content's `instrinsicContentHeight` will be used. | ||
public var idealContentHeight: CGFloat? | ||
|
||
/// Minimum content height of sheet. | ||
/// | ||
/// Only applicable for resizable sheets. | ||
/// A resizable sheet will not be allowed to shrink its content below this value. | ||
public var minimumContentHeight: CGFloat | ||
|
||
/// Default layout. | ||
public static let `default` = Layout() | ||
|
||
// Initializes a bottom sheet layout. | ||
/// - Parameters: | ||
/// - cornerRadius: corner radius of bottom sheet view. Default is `16`. | ||
/// - minimumTopOffset: minimum top offset. Default is `44`. | ||
/// - maximumContentHeight: maximum content height of sheet. Default is `nil`. | ||
/// - idealContentHeight: ideal content height of sheet. Default is `nil`. | ||
/// - minimumContentHeight: minimum content height of sheet. Default is `88`. | ||
public init( | ||
cornerRadius: CGFloat = 16, | ||
minimumTopOffset: CGFloat = 44, | ||
maximumContentHeight: CGFloat? = nil, | ||
idealContentHeight: CGFloat? = nil, | ||
minimumContentHeight: CGFloat = 88 | ||
) { | ||
self.cornerRadius = cornerRadius | ||
self.minimumTopOffset = minimumTopOffset | ||
self.maximumContentHeight = maximumContentHeight | ||
self.idealContentHeight = idealContentHeight | ||
self.minimumContentHeight = minimumContentHeight | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
Sources/YBottomSheet/BottomSheetController.Appearance+Layout.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...DragIndicatorView.Appearance+Layout.swift → ...DragIndicatorView+Appearance+Layout.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.