Skip to content

Commit

Permalink
fix: Create Widget View의 네비게이션 바와 UI 겹침 현상 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
heonha committed Oct 21, 2023
1 parent e8c19ca commit 4bc983b
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 31 deletions.
16 changes: 12 additions & 4 deletions koget.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@
39F8475329B3990B000B817E /* FirebaseFirestore in Frameworks */ = {isa = PBXBuildFile; productRef = 39F8475229B3990B000B817E /* FirebaseFirestore */; };
39F8475529B3990B000B817E /* FirebaseFirestoreSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 39F8475429B3990B000B817E /* FirebaseFirestoreSwift */; };
39F8475729B3990B000B817E /* FirebaseStorage in Frameworks */ = {isa = PBXBuildFile; productRef = 39F8475629B3990B000B817E /* FirebaseStorage */; };
39FB3EE72AE3AACC00B5B30C /* BasicButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39FB3EE62AE3AACC00B5B30C /* BasicButtonStyle.swift */; };
39FB3EE92AE3AAF000B5B30C /* BaseButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39FB3EE82AE3AAF000B5B30C /* BaseButton.swift */; };
3A00CA662931EFBE004FBF80 /* EditTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A00CA652931EFBE004FBF80 /* EditTextField.swift */; };
3A00CA692931F3F1004FBF80 /* StorageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A00CA682931F3F1004FBF80 /* StorageProvider.swift */; };
3A01E785296AD3470019CD2D /* ContactView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A01E784296AD3470019CD2D /* ContactView.swift */; };
Expand Down Expand Up @@ -380,6 +382,8 @@
39F0455F29D3AC6A00F4323F /* 1-2-1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "1-2-1.png"; sourceTree = "<group>"; };
39F0456029D3AC6B00F4323F /* 1-2-2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "1-2-2.png"; sourceTree = "<group>"; };
39FADE5A29CBC67F00E7A3FF /* 1-2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "1-2.png"; sourceTree = "<group>"; };
39FB3EE62AE3AACC00B5B30C /* BasicButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicButtonStyle.swift; sourceTree = "<group>"; };
39FB3EE82AE3AAF000B5B30C /* BaseButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseButton.swift; sourceTree = "<group>"; };
3A00CA652931EFBE004FBF80 /* EditTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditTextField.swift; sourceTree = "<group>"; };
3A00CA682931F3F1004FBF80 /* StorageProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageProvider.swift; sourceTree = "<group>"; };
3A01E784296AD3470019CD2D /* ContactView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -926,6 +930,8 @@
isa = PBXGroup;
children = (
3A8339D82932167500DC9527 /* TextButton.swift */,
39FB3EE62AE3AACC00B5B30C /* BasicButtonStyle.swift */,
39FB3EE82AE3AAF000B5B30C /* BaseButton.swift */,
);
path = Button;
sourceTree = "<group>";
Expand Down Expand Up @@ -1376,9 +1382,11 @@
394D69FF2A3467D600EC0A02 /* LottieContainerView.swift in Sources */,
39B0C3812AAC5F92004E0985 /* DeepLinkEntry.swift in Sources */,
39694FDE29E6825B00F2C75C /* IntentHandler.swift in Sources */,
39FB3EE92AE3AAF000B5B30C /* BaseButton.swift in Sources */,
390B5CBC29B1AED900B61E35 /* MainTabView.swift in Sources */,
39D441AA2A5BF97C00C9D11D /* SettingButtonTypes.swift in Sources */,
39BD3EE42A13D1EC00E14DCA /* URL+Extension.swift in Sources */,
39FB3EE72AE3AACC00B5B30C /* BasicButtonStyle.swift in Sources */,
3A01E785296AD3470019CD2D /* ContactView.swift in Sources */,
39E7AA1E2A1BC6290012616D /* UIImage+Extension.swift in Sources */,
39ADB2752A4A6C1B00AED318 /* HomeWidgetView.swift in Sources */,
Expand Down Expand Up @@ -1739,7 +1747,7 @@
CODE_SIGN_ENTITLEMENTS = koget/koget.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 127.0;
CURRENT_PROJECT_VERSION = 128.0;
DEVELOPMENT_TEAM = ZH5GA3W8UP;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = koget/Info.plist;
Expand All @@ -1755,7 +1763,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.7;
MARKETING_VERSION = 1.2.8;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.heon.koget;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1780,7 +1788,7 @@
CODE_SIGN_ENTITLEMENTS = koget/koget.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 127.0;
CURRENT_PROJECT_VERSION = 128.0;
DEVELOPMENT_TEAM = ZH5GA3W8UP;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = koget/Info.plist;
Expand All @@ -1796,7 +1804,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.7;
MARKETING_VERSION = 1.2.8;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.heon.koget;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
18 changes: 18 additions & 0 deletions koget/UI/Components/Button/BaseButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// BaseButton.swift
// koget
//
// Created by HeonJin Ha on 10/21/23.
//
//
// import SwiftUI
//
// struct BaseButton: View {
//
// var action: () -> ()
// var buttonLabel: () -> Text
//
// var body: some View {
//
// }
// }
18 changes: 18 additions & 0 deletions koget/UI/Components/Button/BasicButtonStyle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// BasicButtonStyle.swift
// koget
//
// Created by HeonJin Ha on 10/21/23.
//

import SwiftUI

struct BasicButtonStyle: ButtonStyle {

func makeBody(configuration: Configuration) -> some View {
configuration.label
.opacity(configuration.isPressed ? 0.3 : 1)
.animation(configuration.isPressed ? .none : .easeInOut(duration: 0.15), value: configuration.isPressed)
}

}
2 changes: 1 addition & 1 deletion koget/UI/Components/Button/TextButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ struct TextButton: View {
var titleColor: Color = AppColor.Label.first
var backgroundColor: Color
let font: Font = .custom(.robotoMedium, size: 18)
var action: () -> Void

var action: () -> Void
var body: some View {
Button {
action()
Expand Down
2 changes: 1 addition & 1 deletion koget/UI/Components/NavigationButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct NavigationButton<Destination: View>: View {
.renderingMode(.template)
.foregroundColor(.init(uiColor: .tertiarySystemBackground))
.aspectRatio(contentMode: .fit)
.padding(2)
.padding(3)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions koget/UI/Create/Asset/CreateWidgetAssetList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct CreateWidgetAssetList: View {
ZStack {
AppColor.Background.first
.ignoresSafeArea()

VStack {

Text(appList)
Expand Down
1 change: 0 additions & 1 deletion koget/UI/Create/CreateButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ extension CreateButton {
} catch {
viewModel.showErrorAlert(error as! CreateWidgetError)
}

} label: {
buttonLabel
}
Expand Down
6 changes: 5 additions & 1 deletion koget/UI/Create/CreateWidgetContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ struct CreateWidgetContainer: View {

var body: some View {
CreateWidgetView($page, viewModel: viewModel)
.navigationBarBackButtonHidden()
.safeAreaInset(edge: .top, alignment: .center, spacing: 0) {
Color.clear
.frame(height: 0)
.background(Material.bar)
}
}
}

Expand Down
41 changes: 23 additions & 18 deletions koget/UI/Create/CreateWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ struct CreateWidgetView: View {
}

var body: some View {
mainBody
.overlay(alignment: .center) {
if viewModel.showAlert {
alertToast()
ScrollView {
mainBody
.overlay(alignment: .center) {
if viewModel.showAlert {
alertToast()
}
}
}
.animation(.default, value: viewModel.showAlert)
.overlay(alignment: .topLeading) {
backButton()
.padding(.leading, 8)
}
.animation(.default, value: viewModel.showAlert)
}

}

func alertToast() -> some View {
Expand All @@ -47,25 +46,31 @@ struct CreateWidgetView: View {

var mainBody: some View {
ZStack {
Rectangle()
.fill(.clear)

VStack(spacing: 40) {
Spacer()
titleView(page.viewData.title)

iconSelector(page.viewData.icon)

youtubeLink()

nameAndUrlTextfield

buttonList()

Spacer()
}
.frame(minHeight: Constants.deviceSize.height / 1.4, maxHeight: Constants.deviceSize.height / 1.3)
.padding(.horizontal, 24)

}
.ignoresSafeArea(.keyboard, edges: .all)
.navigationBarBackButtonHidden()
.toolbar {
ToolbarItem(placement: .cancellationAction) {
backButton()
}
}
.navigationTitle("위젯 만들기")
.background(CircleBlurBackground())
}

private var nameAndUrlTextfield: some View {
Expand Down Expand Up @@ -135,11 +140,11 @@ struct CreateWidgetView: View {
Button {
backButtonAction()
} label: {
HStack {
HStack(spacing: 2) {
Image(systemName: "chevron.left")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 20, height: 20)
.frame(width: 18, height: 16)

Text("뒤로")
.font(.custom(.robotoMedium, size: 16))
Expand Down
3 changes: 2 additions & 1 deletion koget/UI/Home/CircleBlurBackground.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ struct CircleBlurBackground: View {
.fill(Color.red)
.scaleEffect (0.40, anchor: .trailing)
.offset(y: -20)
.blur (radius: 120)
.blur(radius: 120)
}
.opacity(0.3)
}
}
}
Expand Down
17 changes: 13 additions & 4 deletions koget/UI/Home/HomeWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ struct HomeWidgetView: View {
var body: some View {
NavigationView {
ZStack {
CircleBlurBackground()

mainBody()
.background(CircleBlurBackground())
.toolbar { createToolbar() }
}
}
.navigationViewStyle(StackNavigationViewStyle())
.safeAreaInset(edge: .bottom) {
Color.clear
.frame(height: 0)
.background(Material.bar)
}
.environmentObject(viewModel)

}

}
Expand Down Expand Up @@ -128,7 +132,12 @@ extension HomeWidgetView {
private func cellScrollViewSwitch(_ type: WidgetViewType, isEmpty: Bool) -> some View {
ZStack {
if isEmpty {
EmptyWidgetPlaceholder()
NavigationLink {
CreateWidgetContainer()
} label: {
EmptyWidgetPlaceholder()
}

} else {
switch type {
case .grid:
Expand Down
2 changes: 2 additions & 0 deletions koget/UI/MainTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ struct MainTabView: View {
.tabItem {
Image(systemSymbol: SFSymbol.gearshape)
}

}

}

}
Expand Down
1 change: 1 addition & 0 deletions koget/UI/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct MainView: View {
MainTabView()
.preferredColorScheme(constant.isDarkMode ? .dark : .light)
.animation(.linear(duration: 0.2), value: constant.isDarkMode)

}
}

Expand Down
5 changes: 5 additions & 0 deletions koget/UI/Setting/SettingMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ struct SettingMenu: View {
.navigationTitle("앱 설정")
.navigationBarTitleDisplayMode(.large)
}
.safeAreaInset(edge: .bottom) {
Color.clear
.frame(height: 0)
.background(Material.bar)
}
.navigationViewStyle(StackNavigationViewStyle())
}

Expand Down

0 comments on commit 4bc983b

Please sign in to comment.