Skip to content

Commit

Permalink
Only update view constraints when the view has been added to the view…
Browse files Browse the repository at this point in the history
… hierarchy in AboutViewController
  • Loading branch information
sitomani committed Feb 13, 2024
1 parent 13906fb commit 675ddc0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions 4champ/Scenes/About/AboutViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,16 @@ class AboutViewController: UIViewController, AboutDisplayLogic {
UIUtils.roundCornersInView(tableView)
navigationItem.title = "AboutView_Title".l13n().uppercased()

toggleNowPlaying(modulePlayer.status.rawValue > PlayerStatus.stopped.rawValue)

let img = UIImage(named: "favestar-grey")?.withRenderingMode(.alwaysTemplate)
let buttonItem = UIBarButtonItem.init(image: img, landscapeImagePhone: img, style: .plain, target: self, action: #selector(reviewNow))
self.navigationItem.leftBarButtonItem = buttonItem
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
toggleNowPlaying(modulePlayer.status.rawValue > PlayerStatus.stopped.rawValue)
}

// MARK: Display Logic
func displayNowPlaying(_ viewModel: About.Status.ViewModel) {
}
Expand All @@ -88,12 +91,14 @@ class AboutViewController: UIViewController, AboutDisplayLogic {
}

extension AboutViewController: NowPlayingContainer {

func toggleNowPlaying(_ value: Bool) {
guard view.window != nil else { return }
log.debug("")
if value {
bottomAnchor?.constant = -(50.0 + 10.0)
} else {
bottomAnchor?.constant = -10.0
if value {
bottomAnchor?.constant = -(50.0 + 10.0)
} else {
bottomAnchor?.constant = -10.0
}
view.layoutIfNeeded()
}
Expand Down

0 comments on commit 675ddc0

Please sign in to comment.