Skip to content

Commit b6a161d

Browse files
author
Mohammed Rokon Uddin
authored
Merge pull request #17 from rokon-uddin/refactor_repository
chore: refactor the repository by implementing generics
2 parents 642c30c + ca76092 commit b6a161d

File tree

79 files changed

+2658
-4935
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2658
-4935
lines changed

TCA.xctemplate/___FILEBASENAME___/___FILEBASENAME___Feature.swift

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,61 @@
66
//___COPYRIGHT___
77
//
88

9-
import Domain
109
import Commons
11-
import Foundation
1210
import ComposableArchitecture
11+
import Domain
12+
import Foundation
13+
14+
public struct ___VARIABLE_moduleName___Feature: Reducer {
15+
16+
public struct State: Equatable {
17+
public init() {}
18+
}
19+
20+
public enum Action: BaseAction {
21+
22+
enum ViewAction: Equatable {
23+
case onAppear
1324

14-
public struct ___VARIABLE_moduleName___Feature: Reducer {
15-
16-
public struct State: Equatable {
17-
public init() {}
1825
}
19-
20-
public enum Action: BaseAction {
21-
22-
enum ViewAction: Equatable {
23-
case onAppear
24-
25-
}
26-
27-
enum InlyingAction: Equatable {
28-
29-
}
30-
31-
enum DelegateAction: Equatable {
32-
33-
}
34-
35-
case view(ViewAction)
36-
case inlying(InlyingAction)
37-
case delegate(DelegateAction)
26+
27+
enum InlyingAction: Equatable {
28+
3829
}
39-
40-
public func reduce(into state: inout State, action: Action) -> Effect<Action> {
41-
switch action {
42-
case .view(let action):
43-
switch action {
44-
case .onAppear:
45-
return .none
46-
47-
}
48-
case .inlying(let action):
49-
switch action {
50-
51-
}
52-
case .delegate(let action):
53-
switch action {
54-
55-
}
56-
}
30+
31+
enum DelegateAction: Equatable {
32+
5733
}
58-
59-
// Remove commented code if not needed
60-
// public var body: some Reducer<State, Action> {
61-
//
62-
// Reduce { state, action in
63-
//
64-
// }
65-
// }
34+
35+
case view(ViewAction)
36+
case inlying(InlyingAction)
37+
case delegate(DelegateAction)
38+
}
39+
40+
public func reduce(into state: inout State, action: Action) -> Effect<Action> {
41+
switch action {
42+
case .view(let action):
43+
switch action {
44+
case .onAppear:
45+
return .none
46+
47+
}
48+
case .inlying(let action):
49+
switch action {
50+
51+
}
52+
case .delegate(let action):
53+
switch action {
54+
55+
}
56+
}
57+
}
58+
59+
// Remove commented code if not needed
60+
// public var body: some Reducer<State, Action> {
61+
//
62+
// Reduce { state, action in
63+
//
64+
// }
65+
// }
6666
}

TCA.xctemplate/___FILEBASENAME___/___FILEBASENAME___View.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
//___COPYRIGHT___
77
//
88

9-
import SwiftUI
109
import Commons
11-
import Resources
1210
import ComposableArchitecture
11+
import Resources
12+
import SwiftUI
1313

1414
public struct ___VARIABLE_moduleName___View: View {
15-
let store: StoreOf<___VARIABLE_moduleName___Feature>
15+
let store: StoreOf<___VARIABLE_moduleName___Feature>
1616

17-
public init(store: StoreOf<___VARIABLE_moduleName___Feature>) {
18-
self.store = store
19-
}
17+
public init(store: StoreOf<___VARIABLE_moduleName___Feature>) {
18+
self.store = store
19+
}
2020

21-
public var body: some View {
22-
WithViewStore(self.store, observe: { $0 }) { viewStore in
23-
Text("Hello World!!!")
24-
.onAppear {
25-
viewStore.send(.onAppear)
26-
}
21+
public var body: some View {
22+
WithViewStore(self.store, observe: { $0 }) { viewStore in
23+
Text("Hello World!!!")
24+
.onAppear {
25+
viewStore.send(.onAppear)
2726
}
2827
}
28+
}
2929
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"fileScopedDeclarationPrivacy" : {
3+
"accessLevel" : "private"
4+
},
5+
"indentation" : {
6+
"spaces" : 2
7+
},
8+
"indentConditionalCompilationBlocks" : true,
9+
"indentSwitchCaseLabels" : false,
10+
"lineBreakAroundMultilineExpressionChainComponents" : false,
11+
"lineBreakBeforeControlFlowKeywords" : false,
12+
"lineBreakBeforeEachArgument" : false,
13+
"lineBreakBeforeEachGenericRequirement" : false,
14+
"lineLength" : 80,
15+
"tabWidth" : 8,
16+
"maximumBlankLines" : 1,
17+
"prioritizeKeepingFunctionOutputTogether" : false,
18+
"respectsExistingLineBreaks" : true,
19+
"version" : 1,
20+
"rules" : {
21+
"AllPublicDeclarationsHaveDocumentation" : false,
22+
"AlwaysUseLowerCamelCase" : true,
23+
"AmbiguousTrailingClosureOverload" : true,
24+
"BeginDocumentationCommentWithOneLineSummary" : false,
25+
"DoNotUseSemicolons" : true,
26+
"DontRepeatTypeInStaticProperties" : true,
27+
"FileScopedDeclarationPrivacy" : true,
28+
"FullyIndirectEnum" : true,
29+
"GroupNumericLiterals" : true,
30+
"IdentifiersMustBeASCII" : true,
31+
"NeverForceUnwrap" : false,
32+
"NeverUseForceTry" : false,
33+
"NeverUseImplicitlyUnwrappedOptionals" : false,
34+
"NoAccessLevelOnExtensionDeclaration" : true,
35+
"NoBlockComments" : true,
36+
"NoCasesWithOnlyFallthrough" : true,
37+
"NoEmptyTrailingClosureParentheses" : true,
38+
"NoLabelsInCasePatterns" : true,
39+
"NoLeadingUnderscores" : false,
40+
"NoParensAroundConditions" : true,
41+
"NoVoidReturnOnFunctionSignature" : true,
42+
"OneCasePerLine" : true,
43+
"OneVariableDeclarationPerLine" : true,
44+
"OnlyOneTrailingClosureArgument" : false,
45+
"OrderedImports" : true,
46+
"ReturnVoidInsteadOfEmptyTuple" : true,
47+
"UseEarlyExits" : false,
48+
"UseLetInEveryBoundCaseVariable" : false,
49+
"UseShorthandTypeNames" : true,
50+
"UseSingleLinePropertyGetter" : true,
51+
"UseSynthesizedInitializer" : true,
52+
"UseTripleSlashForDocumentationComments" : true,
53+
"UseWhereClausesInForLoops" : false,
54+
"ValidateDocumentationComments" : false
55+
}
56+
}

{{cookiecutter.app_name}}/.swiftformat

Lines changed: 0 additions & 5 deletions
This file was deleted.

{{cookiecutter.app_name}}/Common/Package.swift

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,27 @@
44
import PackageDescription
55

66
let package = Package(
7-
name: "Common",
8-
platforms: [.macOS(.v12), .iOS(.v15)],
9-
products: [
10-
.library(
11-
name: "Common",
12-
targets: ["Common"]),
13-
],
14-
dependencies: [
15-
.package(
16-
url: "https://github.com/pointfreeco/swift-composable-architecture",
17-
exact: "1.5.1"
18-
),
19-
],
20-
targets: [
21-
.target(
22-
name: "Common",
23-
dependencies: [
24-
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
25-
]
26-
),
27-
]
7+
name: "Common",
8+
platforms: [.macOS(.v12), .iOS(.v15)],
9+
products: [
10+
.library(
11+
name: "Common",
12+
targets: ["Common"])
13+
],
14+
dependencies: [
15+
.package(
16+
url: "https://github.com/pointfreeco/swift-composable-architecture",
17+
exact: "1.5.1"
18+
)
19+
],
20+
targets: [
21+
.target(
22+
name: "Common",
23+
dependencies: [
24+
.product(
25+
name: "ComposableArchitecture",
26+
package: "swift-composable-architecture")
27+
]
28+
)
29+
]
2830
)

0 commit comments

Comments
 (0)