Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii committed Mar 31, 2024
1 parent 2820945 commit 25abf1f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Sources/DynamicList/DynamicListView.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
import SwiftUI
import UIKit

/**
A key using types that brings custom state into cell.

```swift
enum IsArchivedKey: CustomStateKey {
typealias Value = Bool

static var defaultValue: Bool { false }
}
```

```swift
extension CellState {
var isArchived: Bool {
get { self[IsArchivedKey.self] }
set { self[IsArchivedKey.self] = newValue }
}
}
```
*/
public protocol CustomStateKey {
associatedtype Value

static var defaultValue: Value { get }
}

/**
Additional cell state storage.
Refer `CustomStateKey` to use your own state for cell.
*/
public struct CellState {

public static let empty = CellState()
Expand Down

0 comments on commit 25abf1f

Please sign in to comment.