Skip to content

Commit

Permalink
✨ :: setting TabView
Browse files Browse the repository at this point in the history
  • Loading branch information
uuuunseo committed Sep 11, 2024
1 parent 8eadfc2 commit 53943d1
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 15 deletions.
10 changes: 9 additions & 1 deletion Projects/App/iOS/Sources/Application/OndoseeIOSApp.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import SwiftUI
import RootFeature

@main
struct OndoseeIOSApp: App {
var body: some Scene {
WindowGroup {
EmptyView()
RootView(
store: .init(
initialState: .init(),
reducer: {
RootCore()
}
)
)
}
}
}
15 changes: 9 additions & 6 deletions Projects/Feature/MainTabFeature/Sources/MainTabCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import WeeklyForecastFeature
public struct MainTabCore: Reducer {
public init() {}
public struct State: Equatable {
var mainCore: MainCore.State
var weeklyCore: WeeklyForecastCore.State
var settingCore: SettingCore.State

public init() { self = .init() }
var tabFlow: TabFlow = .main
var mainCore = MainCore.State()
var weeklyCore = WeeklyForecastCore.State()
var settingCore = SettingCore.State()
public init() {}
}

public enum Action {
Expand All @@ -23,10 +23,13 @@ public struct MainTabCore: Reducer {
public var body: some Reducer<State, Action> {
Reduce { state, action in
switch action {
case let .changeTabFlow(flow):
state.tabFlow = flow
return .none

default:
return .none
}
return .none
}
}
}
8 changes: 7 additions & 1 deletion Projects/Feature/MainTabFeature/Sources/MainTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ public struct MainTabView: View {

public init(store: StoreOf<MainTabCore>) {
self.store = store
UITabBar.appearance().backgroundColor = .clear
UITabBar.appearance().scrollEdgeAppearance = .init()
}

public var body: some View {
WithViewStore(self.store, observe: { $0 }) { viewStore in
TabView {
TabView(selection: viewStore.binding(
get: \.tabFlow,
send: MainTabCore.Action.changeTabFlow)
) {
MainView(store: store.scope(
state: \.mainCore,
action: MainTabCore.Action.mainCore)
Expand Down Expand Up @@ -50,6 +55,7 @@ public struct MainTabView: View {
.font(.medium(.system, size: .text3))
}
}
.accentColor(.ondosee(.system(.selected)))
}
}
}
2 changes: 0 additions & 2 deletions Projects/Feature/MainTabFeature/Sources/Sources.swift

This file was deleted.

16 changes: 16 additions & 0 deletions Projects/Feature/RootFeature/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import DependencyPlugin
import ProjectDescription
import ProjectDescriptionHelpers

let project = Project.module(
name: ModulePaths.Feature.RootFeature.rawValue,
targets: [
.implements(module: .feature(.RootFeature), dependencies: [
.feature(target: .BaseFeature),
.feature(target: .MainTabFeature)
]),
.tests(module: .feature(.RootFeature), dependencies: [
.feature(target: .RootFeature)
])
]
)
26 changes: 26 additions & 0 deletions Projects/Feature/RootFeature/Sources/RootCore.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import ComposableArchitecture
import Foundation
import MainTabFeature

public struct RootCore: Reducer {
public init() {}
public enum State: Equatable {
case mainTab(MainTabCore.State)

public init() { self = .mainTab(.init()) }
}

public enum Action {
case mainTabCore(MainTabCore.Action)
}

public var body: some Reducer<State, Action> {
Reduce { state, action in
switch action {
case .mainTabCore:
state = .mainTab(.init())
return .none
}
}
}
}
22 changes: 22 additions & 0 deletions Projects/Feature/RootFeature/Sources/RootView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import ComposableArchitecture
import SwiftUI
import MainTabFeature

public struct RootView: View {
private let store: StoreOf<RootCore>

public init(store: StoreOf<RootCore>) {
self.store = store
}

public var body: some View {
SwitchStore(store) {
switch $0 {
case .mainTab:
CaseLet(/RootCore.State.mainTab, action: RootCore.Action.mainTabCore) { store in
MainTabView(store: store)
}
}
}
}
}
1 change: 1 addition & 0 deletions Projects/Feature/RootFeature/Tests/Tests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This is For Tuist
2 changes: 1 addition & 1 deletion Projects/Feature/SettingFeature/Sources/SettingCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation
public struct SettingCore: Reducer {
public init() {}
public struct State: Equatable {

public init() {}
}

public enum Action: Equatable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import Foundation
public struct WeeklyForecastCore: Reducer {
public init() {}
public struct State: Equatable {

public init() {}
}

public enum Action: Equatable {

}

public func reduce(into state: inout State, action: Action) -> Effect<Action> {

public func reduce(into state: inout State, action: Action) -> Effect<Action> {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00",
"red" : "0x00"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public extension Color.OndoseeColorSystem {
case secondary
case tertiary
case warning
case selected
}
}

Expand All @@ -18,6 +19,7 @@ public extension Color.OndoseeColorSystem.System {
case .secondary: return DesignSystemAsset.System.secondary.swiftUIColor
case .tertiary: return DesignSystemAsset.System.tertiary.swiftUIColor
case .warning: return DesignSystemAsset.System.warning.swiftUIColor
case .selected: return DesignSystemAsset.System.selected.swiftUIColor
}
}
}

0 comments on commit 53943d1

Please sign in to comment.