Skip to content

Commit

Permalink
feat: onboarding scene 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
mooyoung2309 committed Oct 26, 2023
1 parent 3254877 commit d5b5812
Show file tree
Hide file tree
Showing 12 changed files with 274 additions and 2 deletions.
10 changes: 10 additions & 0 deletions D3N.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
</dict>
</plist>
7 changes: 6 additions & 1 deletion Targets/D3N/Sources/App/RootStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ import ComposableArchitecture
struct RootStore: Reducer {

enum State: Equatable {
case onboarding(OnboardingNavigationStackStore.State)
case mainTab(MainTabStore.State)

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

enum Action: Equatable {
case onboarding(OnboardingNavigationStackStore.Action)
case mainTab(MainTabStore.Action)
}

Expand All @@ -29,7 +32,9 @@ struct RootStore: Reducer {
default: return .none
}
}

.ifCaseLet(/State.onboarding, action: /Action.onboarding) {
OnboardingNavigationStackStore()
}
.ifCaseLet(/State.mainTab, action: /Action.mainTab) {
MainTabStore()
}
Expand Down
4 changes: 4 additions & 0 deletions Targets/D3N/Sources/App/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ struct RootView: View {
var body: some View {
SwitchStore(self.store) {
switch $0 {
case .onboarding:
CaseLet(/RootStore.State.onboarding, action: RootStore.Action.onboarding) {
OnboardingNavigationStackView(store: $0)
}
case .mainTab:
CaseLet(/RootStore.State.mainTab, action: RootStore.Action.mainTab) {
MainTabView(store: $0)
Expand Down
1 change: 0 additions & 1 deletion Targets/D3N/Sources/Feature/MainTab/MainTabStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ enum MainScene: Hashable {
}

struct MainTabStore: Reducer {

struct State: Equatable {
var currentScene: MainScene = .question

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// OnboardingNicknameStore.swift
// D3N
//
// Created by 송영모 on 10/26/23.
// Copyright © 2023 sju. All rights reserved.
//

import Foundation

import ComposableArchitecture

public struct OnboardingNicknameStore: Reducer {
public struct State: Equatable {
public init() { }
}

public enum Action: Equatable {
case onAppear

case delegate(Delegate)

public enum Delegate: Equatable {
case select(NewsEntity)
}
}

public var body: some ReducerOf<Self> {
Reduce { state, action in
switch action {
case .onAppear:
return .none

default:
return .none
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// OnboardingNicknameView.swift
// D3N
//
// Created by 송영모 on 10/26/23.
// Copyright © 2023 sju. All rights reserved.
//

import SwiftUI

import ComposableArchitecture

struct OnboardingNicknameView: View {
let store: StoreOf<OnboardingNicknameStore>

var body: some View {
WithViewStore(self.store, observe: { $0 }) { viewStore in
VStack {
Text("닉네임을 입력해주세요.")
.font(.largeTitle)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//
// OnboardingNavigationStackStore.swift
// D3N
//
// Created by 송영모 on 10/26/23.
// Copyright © 2023 sju. All rights reserved.
//

import ComposableArchitecture

public struct OnboardingNavigationStackStore: Reducer {
public struct State: Equatable {
var signUp: OnboardingSignUpStore.State = .init()

var path: StackState<Path.State> = .init()
}

public enum Action: BindableAction, Equatable {
case binding(BindingAction<State>)

case onAppear

case signUp(OnboardingSignUpStore.Action)
case path(StackAction<Path.State, Path.Action>)

case delegate(Delegate)

public enum Delegate {
case complete
}
}

public struct Path: Reducer {
public enum State: Equatable {
case nickname(OnboardingNicknameStore.State)
}

public enum Action: Equatable {
case nickname(OnboardingNicknameStore.Action)
}

public var body: some Reducer<State, Action> {
Scope(state: /State.nickname, action: /Action.nickname) {
OnboardingNicknameStore()
}
}
}

public var body: some ReducerOf<Self> {
BindingReducer()

Reduce { state, action in
switch action {
case .onAppear:
return .none

default:
return .none
}
}
Scope(state: \.signUp, action: /Action.signUp) {
OnboardingSignUpStore()
}
.forEach(\.path, action: /Action.path) {
Path()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// OnboardingNavigationStackView.swift
// D3N
//
// Created by 송영모 on 10/26/23.
// Copyright © 2023 sju. All rights reserved.
//

import SwiftUI

import ComposableArchitecture

public struct OnboardingNavigationStackView: View {
let store: StoreOf<OnboardingNavigationStackStore>

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

public var body: some View {
NavigationStackStore(self.store.scope(
state: \.path,
action: OnboardingNavigationStackStore.Action.path)
) {
WithViewStore(self.store, observe: { $0 }) { viewStore in
OnboardingSignUpView(store: self.store.scope(state: \.signUp, action: OnboardingNavigationStackStore.Action.signUp))
}
} destination: {
switch $0 {
case .nickname:
CaseLet(
/OnboardingNavigationStackStore.Path.State.nickname,
action: OnboardingNavigationStackStore.Path.Action.nickname,
then: OnboardingNicknameView.init(store:)
)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// OnboardingSignUpStore.swift
// D3N
//
// Created by 송영모 on 10/26/23.
// Copyright © 2023 sju. All rights reserved.
//

import Foundation

import ComposableArchitecture

public struct OnboardingSignUpStore: Reducer {
public struct State: Equatable {
public init() { }
}

public enum Action: Equatable {
case onAppear

case delegate(Delegate)

public enum Delegate: Equatable {
case select(NewsEntity)
}
}

public var body: some ReducerOf<Self> {
Reduce { state, action in
switch action {
case .onAppear:
return .none

default:
return .none
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// OnboardingSignUpView.swift
// D3N
//
// Created by 송영모 on 10/26/23.
// Copyright © 2023 sju. All rights reserved.
//

import SwiftUI

import ComposableArchitecture

public struct OnboardingSignUpView: View {
let store: StoreOf<OnboardingSignUpStore>

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

public var body: some View {
WithViewStore(self.store, observe: { $0 }) { viewStore in
VStack {
Text("")
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// OnboardingUserInfoStore.swift
// D3N
//
// Created by 송영모 on 10/26/23.
// Copyright © 2023 sju. All rights reserved.
//

import Foundation
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// OnboardingUserInfoView.swift
// D3N
//
// Created by 송영모 on 10/26/23.
// Copyright © 2023 sju. All rights reserved.
//

import Foundation

0 comments on commit d5b5812

Please sign in to comment.