Skip to content

Commit

Permalink
WIP: Remove bar background
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunn committed Dec 2, 2024
1 parent 0ae71bb commit 657f60d
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ extension AIChatViewController {

public override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .systemBackground
setupNavigationBar()
subscribeToCleanupPublisher()
}
Expand Down Expand Up @@ -95,11 +96,26 @@ extension AIChatViewController {
extension AIChatViewController {

private func setupNavigationBar() {
guard let navigationController = navigationController else { return }

// Make the navigation bar transparent
let appearance = UINavigationBarAppearance()
appearance.configureWithTransparentBackground()
appearance.backgroundColor = .clear
appearance.shadowImage = UIImage()
appearance.shadowColor = .clear

navigationController.navigationBar.standardAppearance = appearance
navigationController.navigationBar.scrollEdgeAppearance = appearance
navigationController.navigationBar.compactAppearance = appearance
navigationController.navigationBar.isTranslucent = true

// Set up the custom title view
let imageView = UIImageView(image: UIImage(named: "Logo"))
imageView.contentMode = .scaleAspectFit
imageView.translatesAutoresizingMaskIntoConstraints = false

let imageSize: CGFloat = 32
let imageSize: CGFloat = 28
NSLayoutConstraint.activate([
imageView.widthAnchor.constraint(equalToConstant: imageSize),
imageView.heightAnchor.constraint(equalToConstant: imageSize)
Expand Down Expand Up @@ -127,6 +143,7 @@ extension AIChatViewController {
navigationItem.rightBarButtonItem = closeButton
}


private func addWebViewController() {
guard webViewController == nil else { return }

Expand All @@ -139,7 +156,7 @@ extension AIChatViewController {
viewController.view.translatesAutoresizingMaskIntoConstraints = false

NSLayoutConstraint.activate([
viewController.view.topAnchor.constraint(equalTo: view.topAnchor),
viewController.view.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
viewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
viewController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
viewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor)
Expand Down

0 comments on commit 657f60d

Please sign in to comment.