Skip to content

Commit dcc79f4

Browse files
Merge pull request #14 from GoodRequest/feature/remove-goodLogger
feat: Remove GoodLogger dependency
2 parents 4d1b704 + 92dfdab commit dcc79f4

11 files changed

Lines changed: 72 additions & 217 deletions

File tree

GoodReactor-Sample/GoodReactor-Sample.xcodeproj/project.pbxproj

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111
09545AF02CB6704900DC5A61 /* LegacyReactor in Frameworks */ = {isa = PBXBuildFile; productRef = 09545AEF2CB6704900DC5A61 /* LegacyReactor */; };
1212
09545AF22CB6705100DC5A61 /* GoodReactor in Frameworks */ = {isa = PBXBuildFile; productRef = 09545AF12CB6705100DC5A61 /* GoodReactor */; };
1313
099D61702C83447900B86922 /* GoodCoordinator in Frameworks */ = {isa = PBXBuildFile; productRef = 099D616F2C83447900B86922 /* GoodCoordinator */; };
14-
099D61732C8472D300B86922 /* GoodNetworking in Frameworks */ = {isa = PBXBuildFile; productRef = 099D61722C8472D300B86922 /* GoodNetworking */; };
15-
099D617F2C84A3CC00B86922 /* RandomNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 099D617C2C84A3CC00B86922 /* RandomNumber.swift */; };
16-
099D61802C84A3CC00B86922 /* RNGEndpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 099D617D2C84A3CC00B86922 /* RNGEndpoint.swift */; };
1714
3F8C10772D4B7E16000A4CC0 /* GoodCoordinator in Frameworks */ = {isa = PBXBuildFile; productRef = 3F8C10762D4B7E16000A4CC0 /* GoodCoordinator */; };
18-
6B9596242D3E690B0037D874 /* GoodNetworking in Frameworks */ = {isa = PBXBuildFile; productRef = 6B9596232D3E690B0037D874 /* GoodNetworking */; };
1915
EA51F944299424A900B14A7C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA51F943299424A900B14A7C /* AppDelegate.swift */; };
2016
EA51F94F299424AA00B14A7C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EA51F94E299424AA00B14A7C /* Assets.xcassets */; };
2117
EA51F952299424AA00B14A7C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA51F950299424AA00B14A7C /* LaunchScreen.storyboard */; };
@@ -38,8 +34,6 @@
3834

3935
/* Begin PBXFileReference section */
4036
092188B02C8CD2A100C6085A /* goodreactor-swiftui-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "goodreactor-swiftui-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; };
41-
099D617C2C84A3CC00B86922 /* RandomNumber.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RandomNumber.swift; sourceTree = "<group>"; };
42-
099D617D2C84A3CC00B86922 /* RNGEndpoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNGEndpoint.swift; sourceTree = "<group>"; };
4337
5D4A974E299CCA0F00DFAEAE /* GoodReactor */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = GoodReactor; path = ..; sourceTree = "<group>"; };
4438
EA51F940299424A900B14A7C /* GoodReactor-Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "GoodReactor-Sample.app"; sourceTree = BUILT_PRODUCTS_DIR; };
4539
EA51F943299424A900B14A7C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -83,24 +77,13 @@
8377
buildActionMask = 2147483647;
8478
files = (
8579
099D61702C83447900B86922 /* GoodCoordinator in Frameworks */,
86-
099D61732C8472D300B86922 /* GoodNetworking in Frameworks */,
8780
09545AF02CB6704900DC5A61 /* LegacyReactor in Frameworks */,
88-
6B9596242D3E690B0037D874 /* GoodNetworking in Frameworks */,
8981
);
9082
runOnlyForDeploymentPostprocessing = 0;
9183
};
9284
/* End PBXFrameworksBuildPhase section */
9385

9486
/* Begin PBXGroup section */
95-
099D617E2C84A3CC00B86922 /* Models */ = {
96-
isa = PBXGroup;
97-
children = (
98-
099D617C2C84A3CC00B86922 /* RandomNumber.swift */,
99-
099D617D2C84A3CC00B86922 /* RNGEndpoint.swift */,
100-
);
101-
path = Models;
102-
sourceTree = "<group>";
103-
};
10487
5D4A974D299CCA0F00DFAEAE /* Packages */ = {
10588
isa = PBXGroup;
10689
children = (
@@ -141,7 +124,6 @@
141124
children = (
142125
EA51F95D299425A600B14A7C /* Application */,
143126
EA751BAF29964F24004016E1 /* Helpers */,
144-
099D617E2C84A3CC00B86922 /* Models */,
145127
EA51F97E2994E03700B14A7C /* Extensions */,
146128
EA51F95E29942B1300B14A7C /* Coordinators */,
147129
EA51F96529942B9400B14A7C /* Screens */,
@@ -302,9 +284,7 @@
302284
name = "GoodReactor-Sample";
303285
packageProductDependencies = (
304286
099D616F2C83447900B86922 /* GoodCoordinator */,
305-
099D61722C8472D300B86922 /* GoodNetworking */,
306287
09545AEF2CB6704900DC5A61 /* LegacyReactor */,
307-
6B9596232D3E690B0037D874 /* GoodNetworking */,
308288
);
309289
productName = "GoodReactor-Sample";
310290
productReference = EA51F940299424A900B14A7C /* GoodReactor-Sample.app */;
@@ -338,7 +318,6 @@
338318
);
339319
mainGroup = EA51F937299424A900B14A7C;
340320
packageReferences = (
341-
6B9596222D3E690B0037D874 /* XCRemoteSwiftPackageReference "GoodNetworking" */,
342321
3F8C10752D4B7E16000A4CC0 /* XCRemoteSwiftPackageReference "GoodCoordinator-iOS" */,
343322
);
344323
productRefGroup = EA51F941299424A900B14A7C /* Products */;
@@ -398,8 +377,6 @@
398377
EABE433C2995128400EB51BD /* Constants.swift in Sources */,
399378
EA6B6D8A2994F30E0035186A /* AboutViewController.swift in Sources */,
400379
EA6B6D892994F30E0035186A /* AboutViewModel.swift in Sources */,
401-
099D617F2C84A3CC00B86922 /* RandomNumber.swift in Sources */,
402-
099D61802C84A3CC00B86922 /* RNGEndpoint.swift in Sources */,
403380
);
404381
runOnlyForDeploymentPostprocessing = 0;
405382
};
@@ -696,15 +673,7 @@
696673
repositoryURL = "https://github.com/GoodRequest/GoodCoordinator-iOS";
697674
requirement = {
698675
kind = upToNextMajorVersion;
699-
minimumVersion = 3.0.3;
700-
};
701-
};
702-
6B9596222D3E690B0037D874 /* XCRemoteSwiftPackageReference "GoodNetworking" */ = {
703-
isa = XCRemoteSwiftPackageReference;
704-
repositoryURL = "https://github.com/GoodRequest/GoodNetworking";
705-
requirement = {
706-
branch = "resource-updating";
707-
kind = branch;
676+
minimumVersion = 3.0.4;
708677
};
709678
};
710679
/* End XCRemoteSwiftPackageReference section */
@@ -726,20 +695,11 @@
726695
isa = XCSwiftPackageProductDependency;
727696
productName = GoodCoordinator;
728697
};
729-
099D61722C8472D300B86922 /* GoodNetworking */ = {
730-
isa = XCSwiftPackageProductDependency;
731-
productName = GoodNetworking;
732-
};
733698
3F8C10762D4B7E16000A4CC0 /* GoodCoordinator */ = {
734699
isa = XCSwiftPackageProductDependency;
735700
package = 3F8C10752D4B7E16000A4CC0 /* XCRemoteSwiftPackageReference "GoodCoordinator-iOS" */;
736701
productName = GoodCoordinator;
737702
};
738-
6B9596232D3E690B0037D874 /* GoodNetworking */ = {
739-
isa = XCSwiftPackageProductDependency;
740-
package = 6B9596222D3E690B0037D874 /* XCRemoteSwiftPackageReference "GoodNetworking" */;
741-
productName = GoodNetworking;
742-
};
743703
/* End XCSwiftPackageProductDependency section */
744704
};
745705
rootObject = EA51F938299424A900B14A7C /* Project object */;

GoodReactor-Sample/GoodReactor-Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 3 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GoodReactor-Sample/GoodReactor-Sample/Application/AppDelegate.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import UIKit
9+
import GoodReactor
910

1011
@main
1112
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -21,8 +22,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2122
UINavigationBar.configureAppearance()
2223

2324
AppCoordinator(window: window).start()
25+
26+
ReactorConfiguration.logger = SampleLogger()
2427

2528
return true
2629
}
2730

2831
}
32+
33+
struct SampleLogger: ReactorLogger {
34+
35+
func logReactorEvent(_ message: Any, level: LogLevel, fileName: String, lineNumber: Int) {
36+
print("[\(level)] \(message) (\(fileName):\(lineNumber))")
37+
}
38+
39+
}

GoodReactor-Sample/GoodReactor-Sample/Models/RNGEndpoint.swift

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

GoodReactor-Sample/GoodReactor-Sample/Models/RandomNumber.swift

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

Package.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@ let package = Package(
2222
dependencies: [
2323
.package(url: "https://github.com/CombineCommunity/CombineExt.git", from: "1.8.1"),
2424
.package(url: "https://github.com/apple/swift-async-algorithms.git", .upToNextMajor(from: "1.0.0")),
25-
.package(url: "https://github.com/apple/swift-collections.git", .upToNextMajor(from: "1.1.3")),
26-
.package(url: "https://github.com/GoodRequest/GoodLogger.git", .upToNextMajor(from: "1.3.0"))
25+
.package(url: "https://github.com/apple/swift-collections.git", .upToNextMajor(from: "1.1.3"))
2726
],
2827
targets: [
2928
.target(
3029
name: "GoodReactor",
3130
dependencies: [
3231
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms"),
33-
.product(name: "Collections", package: "swift-collections"),
34-
.product(name: "GoodLogger", package: "GoodLogger")
32+
.product(name: "Collections", package: "swift-collections")
3533
],
3634
path: "./Sources/GoodReactor",
3735
swiftSettings: [.swiftLanguageMode(.v6)]

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,19 @@ reactor.stateStream
179179
.store(in: &cancellables)
180180
```
181181

182+
## Logging
183+
```swift
184+
struct SampleLogger: ReactorLogger {
185+
186+
func logReactorEvent(_ message: Any, level: LogLevel, fileName: String, lineNumber: Int) {
187+
print("[\(level)] \(message) (\(fileName):\(lineNumber))")
188+
}
189+
190+
}
191+
192+
ReactorConfiguration.logger = SampleLogger()
193+
```
194+
182195
# License
183196
GoodReactor repository is released under the MIT license. See [LICENSE](LICENSE.md) for details.
184197

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// ReactorLogger.swift
3+
// GoodReactor
4+
//
5+
// Created by Matus Klasovity on 09/06/2025.
6+
//
7+
8+
import Foundation
9+
10+
public enum LogLevel {
11+
case debug
12+
}
13+
14+
public protocol ReactorLogger: Sendable {
15+
16+
func logReactorEvent(_ message: Any, level: LogLevel, fileName: String, lineNumber: Int)
17+
18+
}

Sources/GoodReactor/MapTables.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// Created by Filip Šašala on 27/08/2024.
66
//
77

8-
import GoodLogger
9-
108
internal enum MapTables {
119

1210
typealias AnyReactor = AnyObject
@@ -33,7 +31,7 @@ internal enum MapTables {
3331
static let eventStreams = WeakMapTable<AnyReactor, Any>()
3432

3533
// Logger of a reactor
36-
static let loggers = WeakMapTable<AnyReactor, GoodLogger>()
34+
static let loggers = WeakMapTable<AnyReactor, ReactorLogger>()
3735

3836
// Semaphore lock of an event (does not matter which reactor it's running on)
3937
static let eventLocks = WeakMapTable<EventIdentifier, AsyncSemaphore>()

0 commit comments

Comments
 (0)