Skip to content

0.6.0

Latest

Choose a tag to compare

@Dean151 Dean151 released this 22 Jun 11:46

This release brings Linux and Android support, a much richer rule composition vocabulary, new recency/cooldown conditions, and finer-grained trigger throttling — plus rule introspection APIs and documentation improvements.

⚠️ Breaking changes

  • Dropped support for Swift 5.9 and 5.10. RuleKit now requires Swift 6.0+ (Xcode 16+).

🐧 Linux & Android support

RuleKit was previously Apple-only. It now builds and runs on Linux and Android (#2):

  • Replaced OSLog with swift-log — RuleKit's first dependency.
  • Triggers now fire on the main actor by default instead of DispatchQueue.main (an explicit .dispatchQueue(_) option is still honored), avoiding hangs on platforms without a drained main queue. Behavior is unchanged on Apple platforms.
  • .groupContainer is gated to Apple platforms; use .url(_) elsewhere.

✨ Rule composition

  • && and || operators to compose rules, as shorthands for .allOf([...]) and .anyOf([...]).
  • .not(_:) and the ! prefix operator to negate a rule, completing the logic alongside .allOf / .anyOf.
  • noneOf(_:) — fulfilled when none of the given rules are, the complement of anyOf.
  • atLeast(_:of:) — a k-of-n quorum rule that can't be expressed cleanly with allOf / anyOf alone.
  • .always and .never constant rules, useful as placeholders or for conditional composition.

⏱️ Recency & cooldown rules

  • event(_:donatedWithin:) and event(_:notDonatedFor:) — time-window conditions on an event's last donation (recency and cooldowns), taking a TimeInterval in seconds.
  • event(_:atLeast:) shorthand for the common "donated at least N times" condition.
  • timeSinceFirst / timeSinceLast computed properties on Event.Donations.
  • Donations.firstSeenInCurrentVersion — whether an event's first donation happened in the current app version (replacing the hand-written appVersion comparison from the README).

🔁 Trigger frequency

  • Added .every(_:count:) to TriggerFrequencyOption.Frequency, allowing throttle windows like "every 7 days" instead of only fixed calendar cases.

🛠️ API ergonomics & introspection

  • setRule now accepts variadic options and a trailing-closure ruleset, so a single option no longer needs to be wrapped in an array (array-based overloads remain for source compatibility).
  • registeredRuleNames and isRuleRegistered(named:) — read-only APIs to list registered rule identifiers (in registration order) and check membership, keyed by the same name as removeRule(named:).

📚 Documentation

  • Added DocC documentation and improved the README.

Full changelog: 0.5.5...0.6.0