Skip to content

Commit 740bf27

Browse files
committed
Added documentation
1 parent f4fce0b commit 740bf27

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Sources/RuleKit/Center.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,31 @@ extension RuleKit {
112112
try RuleKit.internal.configure(storeLocation: storeLocation)
113113
}
114114

115+
/// - Parameter name: A unique name that will be used as an identifier for registering already triggered rules.
116+
/// - Parameter notification: A notification to trigger when the rules are fulfilled.
117+
/// - Parameter options: Some facultative options to attach to the rule set
118+
/// - Parameter rule: The ruleset that need to be fulfilled to trigger the notification
119+
/// When name is not provided, notification.rawValue is used instead
115120
public static func setRule(_ name: String? = nil, triggering notification: Notification.Name, options: [any RuleKitOption] = [], _ rule: Rule) {
116121
let trigger = NotificationCenterTrigger(rawValue: name, notification: notification)
117122
let rule = options.isEmpty ? rule : RuleWithOptions(options: options, trigger: trigger, rule: rule)
118123
RuleKit.internal.rules.append((rule, trigger))
119124
}
120125

126+
/// - Parameter name: A unique name that will be used as an identifier for registering already triggered rules.
127+
/// - Parameter callback: A closure callback to trigger when the rules are fulfilled.
128+
/// - Parameter options: Some facultative options to attach to the rule set
129+
/// - Parameter rule: The ruleset that need to be fulfilled to trigger the closure
121130
public static func setRule(_ name: String, triggering callback: @escaping @Sendable () -> Void, options: [any RuleKitOption] = [], _ rule: Rule) {
122131
let trigger = CallbackTrigger(rawValue: name, callback: callback)
123132
let rule = options.isEmpty ? rule : RuleWithOptions(options: options, trigger: trigger, rule: rule)
124133
RuleKit.internal.rules.append((rule, trigger))
125134
}
135+
136+
/// - Parameter name: A unique name that will be used as an identifier for registering already triggered rules.
137+
/// - Parameter callback: A closure callback to trigger when the rules are fulfilled.
138+
/// - Parameter options: Some facultative options to attach to the rule set
139+
/// - Parameter rule: The ruleset that need to be fulfilled to trigger the closure
126140
@available(*, deprecated, message: "Use setRule(_:, callback:, options:, rule:) instead")
127141
public static func setRule(triggering callback: @escaping @Sendable () -> Void, name: String, options: [any RuleKitOption] = [], _ rule: Rule) {
128142
setRule(name, triggering: callback, options: options, rule)

Sources/RuleKit/Donation.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ extension RuleKit.Event {
5252
public struct Donations: Sendable, Codable {
5353
static let empty = Donations(count: 0, first: nil, last: nil)
5454

55+
/// The amount of time this donation have been made since last reset
5556
public let count: Int
57+
/// The first donation made since last reset
5658
public let first: Donation?
59+
/// The last donation made since last reset
5760
public let last: Donation?
5861
}
5962
}

0 commit comments

Comments
 (0)