Skip to content

Commit

Permalink
[Issue-1] Consistently end documentation comments with period (.)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Pospesel authored and mpospese committed Feb 23, 2023
1 parent 67f78ae commit 503a36f
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 34 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -129,7 +133,7 @@ sheet.appearance.elevation = Elevation(
opacity: 0.4
)

// Present the sheet
// Present the sheet.
present(sheet, animated: true)
```

Expand Down
6 changes: 3 additions & 3 deletions Sources/YBottomSheet/Animation/BottomSheetAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions Sources/YBottomSheet/BottomSheetController+Appearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions Sources/YBottomSheet/BottomSheetController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ 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)
static let sheetCompressionResistanceLow = UILayoutPriority.defaultLow
static let sheetCompressionResistanceHigh = UILayoutPriority(800)
}

/// Dimmer view
/// Dimmer view.
let dimmerView = UIView()
/// Bottom sheet view.
let sheetView: UIView = {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ open class DragIndicatorView: UIView {
}
}

/// :nodoc:
/// Returns the size of the drag handle.
public override var intrinsicContentSize: CGSize {
appearance.layout.size
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 6 additions & 4 deletions Sources/YBottomSheet/SheetHeaderView/SheetHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 503a36f

Please sign in to comment.