Skip to content

Commit

Permalink
Appearance update
Browse files Browse the repository at this point in the history
  • Loading branch information
flypaper0 committed Nov 14, 2023
1 parent 518f300 commit 6d008d9
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 56 deletions.
17 changes: 0 additions & 17 deletions Example/Showcase/Common/VIPER/SceneViewController.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import SwiftUI

enum NavigationBarStyle {
case translucent(UIColor)
}

protocol SceneViewModel {
var sceneTitle: String? { get }
var largeTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode { get }
var leftBarButtonItem: UIBarButtonItem? { get }
var rightBarButtonItem: UIBarButtonItem? { get }
var navigationBarStyle: NavigationBarStyle { get }
var preferredStatusBarStyle: UIStatusBarStyle { get }
var isNavigationBarTranslucent: Bool { get }

Expand All @@ -28,9 +23,6 @@ extension SceneViewModel {
var rightBarButtonItem: UIBarButtonItem? {
return .none
}
var navigationBarStyle: NavigationBarStyle {
return .translucent(.w_background)
}
var preferredStatusBarStyle: UIStatusBarStyle {
return .default
}
Expand All @@ -56,7 +48,6 @@ class SceneViewController<ViewModel: SceneViewModel, Content: View>: UIHostingCo
super.viewDidLoad()
setupView()
setupNavigation()
setupNavigationBarStyle()
}

@objc required dynamic init?(coder aDecoder: NSCoder) {
Expand All @@ -79,12 +70,4 @@ private extension SceneViewController {
navigationItem.rightBarButtonItem = viewModel.rightBarButtonItem
navigationItem.leftBarButtonItem = viewModel.leftBarButtonItem
}

func setupNavigationBarStyle() {
switch viewModel.navigationBarStyle {
case .translucent(let color):
navigationController?.navigationBar.barTintColor = color
navigationController?.navigationBar.isTranslucent = true
}
}
}
31 changes: 0 additions & 31 deletions Example/WalletApp/Common/VIPER/SceneViewController.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import SwiftUI

enum NavigationBarStyle {
case solid(UIColor)
case clear
}

protocol SceneViewModel {
var sceneTitle: String? { get }
var largeTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode { get }
var leftBarButtonItem: UIBarButtonItem? { get }
var rightBarButtonItem: UIBarButtonItem? { get }
var navigationBarStyle: NavigationBarStyle { get }
var preferredStatusBarStyle: UIStatusBarStyle { get }
var isNavigationBarTranslucent: Bool { get }

Expand All @@ -29,9 +23,6 @@ extension SceneViewModel {
var rightBarButtonItem: UIBarButtonItem? {
return .none
}
var navigationBarStyle: NavigationBarStyle {
return .solid(.w_background)
}
var preferredStatusBarStyle: UIStatusBarStyle {
return .default
}
Expand All @@ -58,11 +49,6 @@ class SceneViewController<ViewModel: SceneViewModel, Content: View>: UIHostingCo
setupNavigation()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setupNavigationBarStyle()
}

@objc required dynamic init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand All @@ -81,21 +67,4 @@ private extension SceneViewController {
navigationItem.rightBarButtonItem = viewModel.rightBarButtonItem
navigationItem.leftBarButtonItem = viewModel.leftBarButtonItem
}

func setupNavigationBarStyle() {
switch viewModel.navigationBarStyle {
case .solid(let color):
navigationController?.navigationBar.setBackgroundImage(color.image(), for: .default)
navigationController?.navigationBar.isTranslucent = false
navigationController?.navigationBar.backgroundColor = color
navigationController?.navigationBar.barTintColor = color
case .clear:
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.shadowImage = UIImage()
navigationController?.navigationBar.isTranslucent = true
navigationController?.navigationBar.backgroundColor = .clear
navigationController?.navigationBar.barTintColor = .clear
navigationController?.navigationBar.tintColor = .w_foreground
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extension BrowserPresenter: SceneViewModel {
}

var largeTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode {
return .always
return .never
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct NotificationsView: View {
}

Rectangle()
.foregroundColor(.black.opacity(0.03))
.foregroundColor(Color.Foreground100.opacity(0.05))
.frame(maxWidth: .infinity)
.frame(height: 1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ extension SubscriptionPresenter: SceneViewModel {
return .never
}

var navigationBarStyle: NavigationBarStyle {
return .clear
}

var rightBarButtonItem: UIBarButtonItem? {
return UIBarButtonItem(
image: UIImage(systemName: "gearshape"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct SettingsView: View {
RoundedRectangle(cornerRadius: Radius.m)
.stroke(Color.red, lineWidth: 1)
)
.padding(.bottom, 24)
}
.padding(.horizontal, 20)
}
Expand Down Expand Up @@ -87,6 +88,7 @@ struct SettingsView: View {
.font(.paragraph700)

Image("copy_small")
.foregroundColor(.Foreground100)

Spacer()
}
Expand All @@ -100,14 +102,14 @@ struct SettingsView: View {
.padding(.horizontal, 12)
.padding(.bottom, 16)
}
.background(Color.black.opacity(0.05).cornerRadius(12))
.background(Color.Foreground100.opacity(0.05).cornerRadius(12))
}
.frame(maxWidth: .infinity)
}

func separator() -> some View {
Rectangle()
.foregroundColor(.black.opacity(0.03))
.foregroundColor(.Foreground100.opacity(0.05))
.frame(maxWidth: .infinity)
.frame(height: 1)
.padding(.top, 8)
Expand Down

0 comments on commit 6d008d9

Please sign in to comment.