Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor the repository by implementing generics #17

Merged
merged 4 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 51 additions & 51 deletions TCA.xctemplate/___FILEBASENAME___/___FILEBASENAME___Feature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,61 +6,61 @@
//___COPYRIGHT___
//

import Domain
import Commons
import Foundation
import ComposableArchitecture
import Domain
import Foundation

public struct ___VARIABLE_moduleName___Feature: Reducer {

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

public enum Action: BaseAction {

enum ViewAction: Equatable {
case onAppear

public struct ___VARIABLE_moduleName___Feature: Reducer {

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

public enum Action: BaseAction {

enum ViewAction: Equatable {
case onAppear

}

enum InlyingAction: Equatable {

}

enum DelegateAction: Equatable {

}

case view(ViewAction)
case inlying(InlyingAction)
case delegate(DelegateAction)

enum InlyingAction: Equatable {

}

public func reduce(into state: inout State, action: Action) -> Effect<Action> {
switch action {
case .view(let action):
switch action {
case .onAppear:
return .none

}
case .inlying(let action):
switch action {

}
case .delegate(let action):
switch action {

}
}

enum DelegateAction: Equatable {

}

// Remove commented code if not needed
// public var body: some Reducer<State, Action> {
//
// Reduce { state, action in
//
// }
// }

case view(ViewAction)
case inlying(InlyingAction)
case delegate(DelegateAction)
}

public func reduce(into state: inout State, action: Action) -> Effect<Action> {
switch action {
case .view(let action):
switch action {
case .onAppear:
return .none

}
case .inlying(let action):
switch action {

}
case .delegate(let action):
switch action {

}
}
}

// Remove commented code if not needed
// public var body: some Reducer<State, Action> {
//
// Reduce { state, action in
//
// }
// }
}
24 changes: 12 additions & 12 deletions TCA.xctemplate/___FILEBASENAME___/___FILEBASENAME___View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
//___COPYRIGHT___
//

import SwiftUI
import Commons
import Resources
import ComposableArchitecture
import Resources
import SwiftUI

public struct ___VARIABLE_moduleName___View: View {
let store: StoreOf<___VARIABLE_moduleName___Feature>
let store: StoreOf<___VARIABLE_moduleName___Feature>

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

public var body: some View {
WithViewStore(self.store, observe: { $0 }) { viewStore in
Text("Hello World!!!")
.onAppear {
viewStore.send(.onAppear)
}
public var body: some View {
WithViewStore(self.store, observe: { $0 }) { viewStore in
Text("Hello World!!!")
.onAppear {
viewStore.send(.onAppear)
}
}
}
}
56 changes: 56 additions & 0 deletions {{cookiecutter.app_name}}/.swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"fileScopedDeclarationPrivacy" : {
"accessLevel" : "private"
},
"indentation" : {
"spaces" : 2
},
"indentConditionalCompilationBlocks" : true,
"indentSwitchCaseLabels" : false,
"lineBreakAroundMultilineExpressionChainComponents" : false,
"lineBreakBeforeControlFlowKeywords" : false,
"lineBreakBeforeEachArgument" : false,
"lineBreakBeforeEachGenericRequirement" : false,
"lineLength" : 80,
"tabWidth" : 8,
"maximumBlankLines" : 1,
"prioritizeKeepingFunctionOutputTogether" : false,
"respectsExistingLineBreaks" : true,
"version" : 1,
"rules" : {
"AllPublicDeclarationsHaveDocumentation" : false,
"AlwaysUseLowerCamelCase" : true,
"AmbiguousTrailingClosureOverload" : true,
"BeginDocumentationCommentWithOneLineSummary" : false,
"DoNotUseSemicolons" : true,
"DontRepeatTypeInStaticProperties" : true,
"FileScopedDeclarationPrivacy" : true,
"FullyIndirectEnum" : true,
"GroupNumericLiterals" : true,
"IdentifiersMustBeASCII" : true,
"NeverForceUnwrap" : false,
"NeverUseForceTry" : false,
"NeverUseImplicitlyUnwrappedOptionals" : false,
"NoAccessLevelOnExtensionDeclaration" : true,
"NoBlockComments" : true,
"NoCasesWithOnlyFallthrough" : true,
"NoEmptyTrailingClosureParentheses" : true,
"NoLabelsInCasePatterns" : true,
"NoLeadingUnderscores" : false,
"NoParensAroundConditions" : true,
"NoVoidReturnOnFunctionSignature" : true,
"OneCasePerLine" : true,
"OneVariableDeclarationPerLine" : true,
"OnlyOneTrailingClosureArgument" : false,
"OrderedImports" : true,
"ReturnVoidInsteadOfEmptyTuple" : true,
"UseEarlyExits" : false,
"UseLetInEveryBoundCaseVariable" : false,
"UseShorthandTypeNames" : true,
"UseSingleLinePropertyGetter" : true,
"UseSynthesizedInitializer" : true,
"UseTripleSlashForDocumentationComments" : true,
"UseWhereClausesInForLoops" : false,
"ValidateDocumentationComments" : false
}
}
5 changes: 0 additions & 5 deletions {{cookiecutter.app_name}}/.swiftformat

This file was deleted.

44 changes: 23 additions & 21 deletions {{cookiecutter.app_name}}/Common/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@
import PackageDescription

let package = Package(
name: "Common",
platforms: [.macOS(.v12), .iOS(.v15)],
products: [
.library(
name: "Common",
targets: ["Common"]),
],
dependencies: [
.package(
url: "https://github.com/pointfreeco/swift-composable-architecture",
exact: "1.5.1"
),
],
targets: [
.target(
name: "Common",
dependencies: [
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
]
),
]
name: "Common",
platforms: [.macOS(.v12), .iOS(.v15)],
products: [
.library(
name: "Common",
targets: ["Common"])
],
dependencies: [
.package(
url: "https://github.com/pointfreeco/swift-composable-architecture",
exact: "1.5.1"
)
],
targets: [
.target(
name: "Common",
dependencies: [
.product(
name: "ComposableArchitecture",
package: "swift-composable-architecture")
]
)
]
)
Loading
Loading