Skip to content

Commit

Permalink
hairline restored for everything aside from the home screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Velin92 committed Sep 8, 2023
1 parent ebcdea2 commit fbf786b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ struct HomeScreen: View {
@State private var isSearching = false
@State private var bloomView: UIView?
@State private var leftBarButtonView: UIView?
@State private var gradientView: UIView?
@State private var navigationBarContainer: UIView?

var body: some View {
GeometryReader { geometry in
Expand Down Expand Up @@ -98,6 +100,8 @@ struct HomeScreen: View {
}
let isHidden = controller.navigationController?.topViewController != controller || isSearching
bloomView?.isHidden = isHidden
gradientView?.isHidden = isHidden
navigationBarContainer?.clipsToBounds = !isHidden
if !isHidden {
updateBloomCenter()
}
Expand All @@ -109,7 +113,9 @@ struct HomeScreen: View {
private var bloomGradient: some View {
LinearGradient(colors: [.clear, .compound.bgCanvasDefault], startPoint: .top, endPoint: .bottom)
.mask {
LinearGradient(colors: [.clear, .white], startPoint: .trailing, endPoint: .leading)
LinearGradient(stops:
[.init(color: .white, location: 0.75), .init(color: .clear, location: 1.0)],
startPoint: .leading, endPoint: .trailing)
}
.ignoresSafeArea(edges: .all)
}
Expand All @@ -120,13 +126,13 @@ struct HomeScreen: View {
return
}

navigationBarContainer.clipsToBounds = true
let hostingController = UIHostingController(rootView: bloom)
hostingController.view.translatesAutoresizingMaskIntoConstraints = true
hostingController.view.backgroundColor = .clear
navigationBarContainer.insertSubview(hostingController.view, at: 0)
self.leftBarButtonView = leftBarButtonView
bloomView = hostingController.view
self.navigationBarContainer = navigationBarContainer
updateBloomCenter()

let gradientController = UIHostingController(rootView: bloomGradient)
Expand All @@ -139,6 +145,7 @@ struct HomeScreen: View {
gradientController.view.leadingAnchor.constraint(equalTo: navigationBarContainer.leadingAnchor),
gradientController.view.heightAnchor.constraint(equalToConstant: 40)]
constraints.forEach { $0.isActive = true }
gradientView = gradientController.view
}

private func updateBloomCenter() {
Expand Down

0 comments on commit fbf786b

Please sign in to comment.