diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/.swiftformat" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/.swiftformat" new file mode 100755 index 0000000..5657d5d --- /dev/null +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/.swiftformat" @@ -0,0 +1,21 @@ +--swiftversion 6.0 + +# format options + +--indent 2 +--selfrequired +--importgrouping alpha +--emptybraces "linebreak" +--enable acronyms +--acronyms "URL, ID, UUID" +--enable blankLineAfterImports +--enable blankLinesAroundMark +--enable blockComments +--enable docComments +--enable isEmpty +--enable markTypes +--enable sortSwitchCases +--enable wrapEnumCases +--enable wrapSwitchCases + +--disable wrapMultilineStatementBraces diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/.swiftlint.yml" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/.swiftlint.yml" new file mode 100755 index 0000000..f7dfa47 --- /dev/null +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/.swiftlint.yml" @@ -0,0 +1,41 @@ +opt_in_rules: + - toggle_bool + - modifier_order + - yoda_condition + - trailing_closure + - vertical_parameter_alignment_on_call + - redundant_nil_coalescing + - prefer_self_type_over_type_of_self + - implicit_return + - empty_string + +disabled_rules: + - trailing_comma + - line_length + - unused_closure_parameter + - multiple_closures_with_trailing_closure + - large_tuple + - todo # This is silly - todos are there for a reason +####################### +## Rule configs +####################### + +force_cast: warning +force_try: warning + +nesting: + type_level: + warning: 4 + +type_name: + allowed_symbols: "_" + +identifier_name: + min_length: + warning: 3 + error: 0 + max_length: + warning: 40 + error: 50 + allowed_symbols: "_" +reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown) diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze.xcodeproj/project.pbxproj" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze.xcodeproj/project.pbxproj" index d25eff9..333b65c 100644 --- "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze.xcodeproj/project.pbxproj" +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze.xcodeproj/project.pbxproj" @@ -87,9 +87,11 @@ isa = PBXNativeTarget; buildConfigurationList = BAD7D1402C41753200E00E16 /* Build configuration list for PBXNativeTarget "pillyze" */; buildPhases = ( + BA5022232C456CB2008E7F9B /* Swift Format */, BAD7D1182C41752F00E00E16 /* Sources */, BAD7D1192C41752F00E00E16 /* Frameworks */, BAD7D11A2C41752F00E00E16 /* Resources */, + BA5022242C456CC8008E7F9B /* SwiftLint */, ); buildRules = ( ); @@ -183,6 +185,8 @@ Base, ); mainGroup = BAD7D1132C41752F00E00E16; + packageReferences = ( + ); productRefGroup = BAD7D11D2C41752F00E00E16 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -218,6 +222,45 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + BA5022232C456CB2008E7F9B /* Swift Format */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Swift Format"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which swiftformat > /dev/null; then\n if [ \"${ENABLE_PREVIEWS}\" = \"YES\" ]; then\n echo \"Not running Swift Format for Xcode Previews\"\n exit 0;\n fi\n swiftformat .\nelse\n echo \"warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat\"\nfi\n"; + }; + BA5022242C456CC8008E7F9B /* SwiftLint */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = SwiftLint; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which swiftlint > /dev/null; then\n swiftlint --config \"$SRCROOT/.swiftlint.yml\"\n # swiftlint --fix && swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ BAD7D1182C41752F00E00E16 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -293,7 +336,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu17; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -357,7 +400,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu17; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Components/PillyzeTabBar.swift" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Components/PillyzeTabBar.swift" index fcb932f..eab2dc4 100644 --- "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Components/PillyzeTabBar.swift" +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Components/PillyzeTabBar.swift" @@ -7,45 +7,48 @@ import SwiftUI +// MARK: - PillyzeTabBar + struct PillyzeTabBar: View { @Binding var activeTab: Tabs var body: some View { - HStack(alignment: .top, spacing: 115) { - ForEach(Tabs.allCases, id: \.rawValue) { tab in - TabBarItem(tab: tab, activeTab: $activeTab - ) - } - } - .padding(.horizontal, 48) - .background { - UnevenRoundedRectangle( - topLeadingRadius: Metrics.cornerRadius, - topTrailingRadius: Metrics.cornerRadius - ) - .fill(.white) - .ignoresSafeArea() - .shadow(color: .pillyzePrimary.opacity(0.1), radius: 8) + HStack(alignment: .top, spacing: 115) { + ForEach(Tabs.allCases, id: \.rawValue) { tab in + TabBarItem(tab: tab, activeTab: $activeTab) } - .background(.white) // 위 모서리가 rounded된 것이 검은 배경으로 보이는 현상 방지 - .overlay { - Button { - print("plus 버튼 탭") - } label: { - Image(.plus) - .frame( - maxWidth: Metrics.centerButtonSize, - maxHeight: Metrics.centerButtonSize - ) - .foregroundStyle(.white) - .background(.pillyzePrimary) - .clipShape(Circle()) - .offset(y: Metrics.centerButtonSize - Metrics.tabBarHeight - Metrics.centerButtonOffset) - } + } + .padding(.horizontal, 48) + .background { + UnevenRoundedRectangle( + topLeadingRadius: Metrics.cornerRadius, + topTrailingRadius: Metrics.cornerRadius + ) + .fill(.white) + .ignoresSafeArea() + .shadow(color: .pillyzePrimary.opacity(0.1), radius: 8) + } + .background(.white) // 위 모서리가 rounded된 것이 검은 배경으로 보이는 현상 방지 + .overlay { + Button { + print("plus 버튼 탭") + } label: { + Image(.plus) + .frame( + maxWidth: Metrics.centerButtonSize, + maxHeight: Metrics.centerButtonSize + ) + .foregroundStyle(.white) + .background(.pillyzePrimary) + .clipShape(Circle()) + .offset(y: Metrics.centerButtonSize - Metrics.tabBarHeight - Metrics.centerButtonOffset) } + } } } +// MARK: - TabBarItem + private struct TabBarItem: View { var tab: Tabs @Binding var activeTab: Tabs @@ -64,6 +67,8 @@ private struct TabBarItem: View { } } +// MARK: - Metrics + private enum Metrics { static let centerButtonOffset: CGFloat = 8 static let cornerRadius: CGFloat = 24 diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/ContentView.swift" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/ContentView.swift" index a5e797a..6010f05 100644 --- "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/ContentView.swift" +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/ContentView.swift" @@ -12,7 +12,7 @@ struct ContentView: View { var body: some View { VStack(spacing: 0) { TabView(selection: $selection) { - Text("MyHealth") + HomeView() .tag(Tabs.myHealth) .toolbar(.hidden, for: .tabBar) diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Models/Tabs.swift" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Models/Tabs.swift" index 9b8eee0..eec8643 100644 --- "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Models/Tabs.swift" +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Models/Tabs.swift" @@ -14,12 +14,12 @@ enum Tabs: String, Hashable, CaseIterable { var image: Image { switch self { case .myHealth: - .init(.myHealth) + .init(.myHealth) case .nutrients: - .init(.nutrients) + .init(.nutrients) } } - + var index: Int { Tabs.allCases.firstIndex(of: self) ?? 0 } diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Scene/Home/HomeView.swift" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Scene/Home/HomeView.swift" new file mode 100644 index 0000000..6dba466 --- /dev/null +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/Sources/Scene/Home/HomeView.swift" @@ -0,0 +1,21 @@ +// +// HomeView.swift +// pillyze +// +// Created by 홍승현 on 7/15/24. +// + +import SwiftUI + +struct HomeView: View { + var body: some View { + ZStack { + ScrollView { + } + } + } +} + +#Preview { + HomeView() +} diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/pillyzeApp.swift" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/pillyzeApp.swift" index 3bfb41e..af26bd7 100644 --- "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/pillyzeApp.swift" +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyze/pillyzeApp.swift" @@ -1,5 +1,5 @@ // -// pillyzeApp.swift +// PillyzeApp.swift // pillyze // // Created by 홍승현 on 7/12/24. @@ -8,7 +8,7 @@ import SwiftUI @main -struct pillyzeApp: App { +struct PillyzeApp: App { var body: some Scene { WindowGroup { ContentView() diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeTests/pillyzeTests.swift" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeTests/pillyzeTests.swift" index e6225a2..9db97d3 100644 --- "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeTests/pillyzeTests.swift" +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeTests/pillyzeTests.swift" @@ -1,12 +1,12 @@ // -// pillyzeTests.swift +// PillyzeTests.swift // pillyzeTests // // Created by 홍승현 on 7/12/24. // -import Testing @testable import pillyze +import Testing -struct pillyzeTests { +struct PillyzeTests { } diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeUITests/pillyzeUITests.swift" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeUITests/pillyzeUITests.swift" index 3514972..74ae60e 100644 --- "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeUITests/pillyzeUITests.swift" +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeUITests/pillyzeUITests.swift" @@ -1,5 +1,5 @@ // -// pillyzeUITests.swift +// PillyzeUITests.swift // pillyzeUITests // // Created by 홍승현 on 7/12/24. @@ -7,7 +7,7 @@ import XCTest -final class pillyzeUITests: XCTestCase { +final class PillyzeUITests: XCTestCase { override func setUpWithError() throws { continueAfterFailure = false } diff --git "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeUITests/pillyzeUITestsLaunchTests.swift" "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeUITests/pillyzeUITestsLaunchTests.swift" index 328e903..2c7f917 100644 --- "a/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeUITests/pillyzeUITestsLaunchTests.swift" +++ "b/\353\251\244\353\262\204-\352\260\234\353\260\234-\355\217\264\353\215\224/\355\231\215\354\212\271\355\230\204/pillyze/pillyzeUITests/pillyzeUITestsLaunchTests.swift" @@ -1,5 +1,5 @@ // -// pillyzeUITestsLaunchTests.swift +// PillyzeUITestsLaunchTests.swift // pillyzeUITests // // Created by 홍승현 on 7/12/24. @@ -7,8 +7,7 @@ import XCTest -final class pillyzeUITestsLaunchTests: XCTestCase { - +final class PillyzeUITestsLaunchTests: XCTestCase { override class var runsForEachTargetApplicationUIConfiguration: Bool { true }