From 503a36fb769bdc17fbd11d946dafc276a34b02b3 Mon Sep 17 00:00:00 2001 From: Mark Pospesel Date: Wed, 22 Feb 2023 16:56:11 +0100 Subject: [PATCH] [Issue-1] Consistently end documentation comments with period (.) --- README.md | 16 ++++++++++------ .../Animation/BottomSheetAnimator.swift | 6 +++--- .../Animation/BottomSheetDismissAnimator.swift | 2 +- .../Animation/BottomSheetPresentAnimator.swift | 2 +- .../BottomSheetController+Appearance.swift | 8 ++++---- ...BottomSheetController.Appearance+Layout.swift | 4 ++-- Sources/YBottomSheet/BottomSheetController.swift | 10 +++++----- .../DragIndicatorView+Appearance.swift | 2 +- .../DragIndicatorView.Appearance+Layout.swift | 2 +- .../DragIndicatorView/DragIndicatorView.swift | 2 +- .../SheetHeaderView+Appearance.swift | 4 ++-- .../SheetHeaderView.Appearance+Layout.swift | 6 +++--- .../SheetHeaderView/SheetHeaderView.swift | 10 ++++++---- 13 files changed, 40 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index c8e01d1..5a0fe7a 100644 --- a/README.md +++ b/README.md @@ -98,26 +98,30 @@ public struct Appearance { public let elevation: Elevation? /// Dimmer view color. Default is 'UIColor.black.withAlphaComponent(0.5)'. public let dimmerColor: UIColor? - /// Animation duration on bottom sheet. Default is `0.3` + /// Animation duration on bottom sheet. Default is `0.3`. public let animationDuration: TimeInterval - /// Animation type during presenting. Default is `curveEaseIn` + /// Animation type during presenting. Default is `curveEaseIn`. public let presentAnimationCurve: UIView.AnimationOptions - /// Animation type during dismissing. Default is `curveEaseOut` + /// Animation type during dismissing. Default is `curveEaseOut`. public let dismissAnimationCurve: UIView.AnimationOptions + /// (Optional) Minimum content view height. Default is `nil`. + /// + /// Only applicable for resizable sheets. `nil` means to use the content view's intrinsic height as the minimum. + public var minimumContentHeight: CGFloat? } ``` **Update or customize appearance** ```swift -// Declare a resizable sheet +// Declare a resizable sheet. let sheet = BottomSheetController( childController: yourViewController, appearance: .defaultResizable ) // Change corner radius, remove dimmer, -// and use a shadow instead +// and use a shadow instead. sheet.appearance.layout.cornerRadius = 24 sheet.appearance.dimmerColor = nil sheet.appearance.elevation = Elevation( @@ -129,7 +133,7 @@ sheet.appearance.elevation = Elevation( opacity: 0.4 ) -// Present the sheet +// Present the sheet. present(sheet, animated: true) ``` diff --git a/Sources/YBottomSheet/Animation/BottomSheetAnimator.swift b/Sources/YBottomSheet/Animation/BottomSheetAnimator.swift index 63920b9..7b0f791 100644 --- a/Sources/YBottomSheet/Animation/BottomSheetAnimator.swift +++ b/Sources/YBottomSheet/Animation/BottomSheetAnimator.swift @@ -8,13 +8,13 @@ import UIKit -/// Base class for bottom sheet present and dismiss animators +/// Base class for bottom sheet present and dismiss animators. class BottomSheetAnimator: NSObject { /// Bottom sheet controller. let sheetViewController: BottomSheetController - /// Initializes a bottom sheet animator - /// - Parameter sheetViewController: Inject bottom sheet controller. + /// Initializes a bottom sheet animator. + /// - Parameter sheetViewController: the sheet being animated. init(sheetViewController: BottomSheetController) { self.sheetViewController = sheetViewController super.init() diff --git a/Sources/YBottomSheet/Animation/BottomSheetDismissAnimator.swift b/Sources/YBottomSheet/Animation/BottomSheetDismissAnimator.swift index d087e1e..22baec8 100644 --- a/Sources/YBottomSheet/Animation/BottomSheetDismissAnimator.swift +++ b/Sources/YBottomSheet/Animation/BottomSheetDismissAnimator.swift @@ -8,7 +8,7 @@ import UIKit -/// Class for dismiss animation. +/// Performs the sheet dismiss animation. class BottomSheetDismissAnimator: BottomSheetAnimator { override func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { guard let fromViewController = transitionContext.viewController(forKey: .from), diff --git a/Sources/YBottomSheet/Animation/BottomSheetPresentAnimator.swift b/Sources/YBottomSheet/Animation/BottomSheetPresentAnimator.swift index 2e93f53..d07cc66 100644 --- a/Sources/YBottomSheet/Animation/BottomSheetPresentAnimator.swift +++ b/Sources/YBottomSheet/Animation/BottomSheetPresentAnimator.swift @@ -8,7 +8,7 @@ import UIKit -/// Class for present animation. +/// Performs the sheet present animation. class BottomSheetPresentAnimator: BottomSheetAnimator { override func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { guard let toViewController = transitionContext.viewController(forKey: .to) else { diff --git a/Sources/YBottomSheet/BottomSheetController+Appearance.swift b/Sources/YBottomSheet/BottomSheetController+Appearance.swift index 488c6eb..159e97b 100644 --- a/Sources/YBottomSheet/BottomSheetController+Appearance.swift +++ b/Sources/YBottomSheet/BottomSheetController+Appearance.swift @@ -22,13 +22,13 @@ extension BottomSheetController { public var elevation: Elevation? /// Dimmer view color. Default is 'UIColor.black.withAlphaComponent(0.5)'. public var dimmerColor: UIColor? - /// Animation duration on bottom sheet. Default is `0.3` + /// Animation duration on bottom sheet. Default is `0.3`. public var animationDuration: TimeInterval - /// Animation type during presenting. Default is `curveEaseIn` + /// Animation type during presenting. Default is `curveEaseIn`. public var presentAnimationCurve: UIView.AnimationOptions - /// Animation type during dismissing. Default is `curveEaseOut` + /// Animation type during dismissing. Default is `curveEaseOut`. public var dismissAnimationCurve: UIView.AnimationOptions - /// (Optional) Minimum content view height. Default is `nil` + /// (Optional) Minimum content view height. Default is `nil`. /// /// Only applicable for resizable sheets. `nil` means to use the content view's intrinsic height as the minimum. public var minimumContentHeight: CGFloat? diff --git a/Sources/YBottomSheet/BottomSheetController.Appearance+Layout.swift b/Sources/YBottomSheet/BottomSheetController.Appearance+Layout.swift index 6876c94..d102841 100644 --- a/Sources/YBottomSheet/BottomSheetController.Appearance+Layout.swift +++ b/Sources/YBottomSheet/BottomSheetController.Appearance+Layout.swift @@ -14,10 +14,10 @@ extension BottomSheetController.Appearance { /// Corner radius of bottom sheet view. Default is `16`. public var cornerRadius: CGFloat - /// Default layout + /// Default layout. public static let `default` = Layout(cornerRadius: 16) - /// Initializes a `Layout`. + /// Initializes a sheet layout. /// - Parameters: /// - cornerRadius: corner radius of bottom sheet view. public init(cornerRadius: CGFloat) { diff --git a/Sources/YBottomSheet/BottomSheetController.swift b/Sources/YBottomSheet/BottomSheetController.swift index e44a9bb..00b3587 100644 --- a/Sources/YBottomSheet/BottomSheetController.swift +++ b/Sources/YBottomSheet/BottomSheetController.swift @@ -27,10 +27,10 @@ public class BottomSheetController: UIViewController { sheetView.frame.origin.y }() - /// Minimum downward velocity beyond which we interpret a pan gesture as a downward swipe + /// Minimum downward velocity beyond which we interpret a pan gesture as a downward swipe. public var dismissThresholdVelocity: CGFloat = 1000 - /// Priorities for various non-required constraints + /// Priorities for various non-required constraints. enum Priorities { static let panGesture = UILayoutPriority(775) static let sheetContentHugging = UILayoutPriority(751) @@ -38,7 +38,7 @@ public class BottomSheetController: UIViewController { static let sheetCompressionResistanceHigh = UILayoutPriority(800) } - /// Dimmer view + /// Dimmer view. let dimmerView = UIView() /// Bottom sheet view. let sheetView: UIView = { @@ -52,14 +52,14 @@ public class BottomSheetController: UIViewController { public private(set) var indicatorView: DragIndicatorView! /// Bottom sheet header view. public private(set) var headerView: SheetHeaderView! - /// Holds the sheet's child content (view or view controller) + /// Holds the sheet's child content (view or view controller). let contentView: UIView = { let view = UIView() view.clipsToBounds = true return view }() - /// Comprises the indicator view, the header view, and the content view + /// Comprises the indicator view, the header view, and the content view. private let stackView: UIStackView = { let stackView = UIStackView() stackView.axis = .vertical diff --git a/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView+Appearance.swift b/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView+Appearance.swift index e83f437..952993f 100644 --- a/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView+Appearance.swift +++ b/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView+Appearance.swift @@ -22,7 +22,7 @@ extension DragIndicatorView { /// Initializes an `Appearance`. /// - Parameters: /// - color: drag indicator background color. - /// - layout: `drag indicator layout properties such as drag indicator size, corner radius. + /// - layout: drag indicator layout properties such as drag indicator size, corner radius. public init( color: UIColor = .tertiaryLabel, layout: Layout = .default diff --git a/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView.Appearance+Layout.swift b/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView.Appearance+Layout.swift index 914bcd5..f5d43cc 100644 --- a/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView.Appearance+Layout.swift +++ b/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView.Appearance+Layout.swift @@ -16,7 +16,7 @@ extension DragIndicatorView.Appearance { /// Size for the drag indicator. Default is {60, 4}. public var size: CGSize - /// Default layout + /// Default layout. public static var `default` = Layout(cornerRadius: 2.0, size: CGSize(width: 60, height: 4)) /// Initializes a `Layout`. diff --git a/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView.swift b/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView.swift index bc3aea3..7514326 100644 --- a/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView.swift +++ b/Sources/YBottomSheet/DragIndicatorView/DragIndicatorView.swift @@ -19,7 +19,7 @@ open class DragIndicatorView: UIView { } } - /// :nodoc: + /// Returns the size of the drag handle. public override var intrinsicContentSize: CGSize { appearance.layout.size } diff --git a/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView+Appearance.swift b/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView+Appearance.swift index b0028d2..5ddadfc 100644 --- a/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView+Appearance.swift +++ b/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView+Appearance.swift @@ -20,10 +20,10 @@ extension SheetHeaderView { /// Header view layout properties such as spacing between views. Default is `.default`. public let layout: Layout - /// Default appearance + /// Default appearance. public static let `default` = Appearance() - /// Initializes an `Appearance`. + /// Initializes a sheet header appearance. /// - Parameters: /// - title: tuple consisting of `textColor` and `typography` for the title label. /// - closeButtonImage: close button image or pass `nil` to hide the button. diff --git a/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView.Appearance+Layout.swift b/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView.Appearance+Layout.swift index 596c53b..da11653 100644 --- a/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView.Appearance+Layout.swift +++ b/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView.Appearance+Layout.swift @@ -17,15 +17,15 @@ extension SheetHeaderView.Appearance { /// The minimum required horizontal spacing between title label and message label. Default is `8.0`. public let gap: CGFloat - /// Default sheet header layout + /// Default sheet header layout. public static let `default` = Layout( contentInset: NSDirectionalEdgeInsets(topAndBottom: 0, leadingAndTrailing: 16), gap: 8 ) - /// Initializes a `Layout`. + /// Initializes a layout. /// - Parameters: - /// - contentInset: custom distance the content is inset from the `HeaderView`. + /// - contentInset: distance the content is inset from the header bounds. /// - gap: horizontal spacing between icon and label. public init( contentInset: NSDirectionalEdgeInsets, diff --git a/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView.swift b/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView.swift index c5cc1cf..d040d47 100644 --- a/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView.swift +++ b/Sources/YBottomSheet/SheetHeaderView/SheetHeaderView.swift @@ -10,9 +10,11 @@ import UIKit import YCoreUI import YMatterType -/// Header view for a bottom sheet to show title and close button. +/// Header view for a bottom sheet to show optional title and optional close button. +/// +/// (If neither title nor close button are visible, the header will not be shown.) open class SheetHeaderView: UIView { - /// Appearance for the sheet header (title text and close button) + /// Appearance for the sheet header (title text and close button). public var appearance: SheetHeaderView.Appearance { didSet { updateViewAppearance() @@ -33,8 +35,8 @@ open class SheetHeaderView: UIView { /// Initializes a sheet header view. /// - Parameters: - /// - title: title text - /// - appearance: appearance for the sheet header + /// - title: title text. + /// - appearance: appearance for the sheet header. public init(title: String, appearance: Appearance = .default) { self.titleLabel.text = title self.appearance = appearance