Skip to content

Commit eadf419

Browse files
committed
Add support for custom logger
1 parent de8a38f commit eadf419

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

Sources/GameControllerKit/GameControllerKit.swift

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ public class GameControllerKit: ObservableObject {
2424
/// Event Handler
2525
public typealias GCKEventHandler = (_ action: GCKAction, _ pressed: Bool, _ controller: GCKController) -> Void
2626

27-
/// Indicates whether a game controller is currently connected.
28-
public var isConnected: Bool = false
29-
3027
/// The type of game controller that is currently connected, if any.
3128
/// This property is nil if no controller is connected.
3229
@Published
@@ -61,11 +58,14 @@ public class GameControllerKit: ObservableObject {
6158
category: "GameControllerKit"
6259
)
6360

61+
/// Indicates whether a game controller is currently connected.
62+
public var isConnected: Bool = false
63+
6464
/// Initializes a new GameControllerKit instance.
6565
/// It sets up notification observers for when game controllers connect or disconnect.
6666
///
67-
/// - Parameter logger: Custom ``Logger`` instance.
68-
public init(_ logger: Logger? = nil) {
67+
/// - Parameter logger: Custom ``Logger`` instance. (optional)
68+
public init(logger: Logger? = nil) {
6969
NotificationCenter.default.addObserver(
7070
forName: .GCControllerDidConnect,
7171
object: nil,
@@ -93,15 +93,6 @@ public class GameControllerKit: ObservableObject {
9393
}
9494
}
9595

96-
/// Set the logger
97-
///
98-
/// Use a custom ``Logger`` instance if you want to have custom logging.
99-
///
100-
/// - Parameter color: Color
101-
public func set(logger: Logger) {
102-
self.logger = logger
103-
}
104-
10596
/// Set color of the controllers light
10697
///
10798
/// Use the light settings to signal the user or to create a more immersive experience.
@@ -124,7 +115,7 @@ public class GameControllerKit: ObservableObject {
124115

125116
/// Plays random colors on your controller (if supported)
126117
/// This is currently only supported on a DualSense and DualShock controller (Playstation)
127-
public func rainbow() {
118+
public func randomColors() {
128119
for counter in 0...10 {
129120
DispatchQueue.main.asyncAfter(deadline: .now() + (Double(counter)/0.99)) {
130121
self.set(color: .GCKRandom)

0 commit comments

Comments
 (0)