-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogoNavigationBar.swift
More file actions
47 lines (39 loc) · 1.52 KB
/
LogoNavigationBar.swift
File metadata and controls
47 lines (39 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import SwiftUI
struct LogoNavigationBarModifier: ViewModifier {
var logo: Image = Image(asset: StackKnowledgeAsset.Logo.logoIcon)
var title: String = "Stack Knowledge"
func body(content: Content) -> some View {
content
.navigationBarBackButtonHidden(true)
.toolbar {
ToolbarItemGroup(placement: .navigationBarLeading) {
HStack {
logo
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 20, height: 20)
Spacer()
.frame(width: 10)
Text(title)
.skFont(.r18)
}
}
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: {
// logout 동작 필요.
}) {
Image(asset: StackKnowledgeAsset.Logout.logoutIcon)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24, height: 24)
.foregroundColor(.primary)
}
}
}
}
}
public extension View {
func logoNavigationBar() -> some View {
self.modifier(LogoNavigationBarModifier())
}
}