Skip to content

Commit

Permalink
Improve Card and CardReview inline docs
Browse files Browse the repository at this point in the history
- Add documentation comments to Card and CardReview structs
- Reorder properties in Card struct, moving 'status' to the top
- Improve CardReview initializer documentation
- Remove outdated comment in CardReview
  • Loading branch information
kaishin committed Oct 24, 2024
1 parent f482a56 commit 4bc4fee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Sources/SwiftFSRS/Models/Card.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import Foundation

public struct Card: Hashable, Codable, Sendable {
/// The current state of the card (New, Learning, Review, Relearning)
public var status: Status

/// Date when the card is next due for review
public var due: Date

Expand All @@ -22,9 +25,6 @@ public struct Card: Hashable, Codable, Sendable {
/// Times the card was forgotten or remembered incorrectly
public var lapses: Int

/// The current state of the card (New, Learning, Review, Relearning)
public var status: Status

/// The most recent review date, if applicable
public var lastReview: Date?

Expand Down
10 changes: 9 additions & 1 deletion Sources/SwiftFSRS/Models/CardReview.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import Foundation

public struct CardReview: Codable {
/// The post-review card.
public var card: Card

/// The review log.
public var reviewLog: ReviewLog

// Unlike other implementations, we only persist pre-review data in the review log
/// Initialize a new card review.
///
/// - Parameters:
/// - card: The post-review card.
/// - oldCard: The pre-review card.
/// - rating: The rating given to the card.
public init(card: Card, oldCard: Card, rating: Rating) {
self.card = card

Expand Down

0 comments on commit 4bc4fee

Please sign in to comment.