Skip to content

Commit

Permalink
Merge pull request #4 from Marcocanc/status-bar-appearance
Browse files Browse the repository at this point in the history
Add support for changing status bar appearance
  • Loading branch information
TosinAF authored Mar 14, 2019
2 parents 15f39a1 + f7cb63c commit 88dc332
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions PanModal/Controller/PanModalPresentationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public class PanModalPresentationController: UIPresentationController {

coordinator.animate(alongsideTransition: { [weak self] _ in
self?.backgroundView.dimState = .max
self?.presentedViewController.setNeedsStatusBarAppearanceUpdate()
})
}

Expand All @@ -203,6 +204,7 @@ public class PanModalPresentationController: UIPresentationController {
coordinator.animate(alongsideTransition: { [weak self] _ in
self?.dragIndicatorView.alpha = 0.0
self?.backgroundView.dimState = .off
self?.presentingViewController.setNeedsStatusBarAppearanceUpdate()
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ extension UIViewController: PanModalPresenter {
viewControllerToPresent.popoverPresentationController?.delegate = PanModalPresentationDelegate.default
} else {
viewControllerToPresent.modalPresentationStyle = .custom
viewControllerToPresent.modalPresentationCapturesStatusBarAppearance = true
viewControllerToPresent.transitioningDelegate = PanModalPresentationDelegate.default
}

Expand Down
4 changes: 4 additions & 0 deletions Sample/View Controllers/BasicViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class BasicViewController: UIViewController {

extension BasicViewController: PanModalPresentable {

override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}

var panScrollable: UIScrollView? {
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ class NavigationController: UINavigationController, PanModalPresentable {

private let navGroups = NavUserGroups()

override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}

override func viewDidLoad() {
super.viewDidLoad()
pushViewController(navGroups, animated: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class StackedProfileViewController: UIViewController, PanModalPresentable {

let presentable: UserGroupMemberPresentable

override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}

// MARK: - Views

let avatarView: UIView = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class UserGroupViewController: UITableViewController, PanModalPresentable, UIGes

var isShortFormEnabled = true

override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}

let headerView = UserGroupHeaderView()

let headerPresentable = UserGroupHeaderPresentable.init(handle: "ios-engs", description: "iOS Engineers", memberCount: 10)
Expand Down

0 comments on commit 88dc332

Please sign in to comment.