# SectionBy

    public struct SectionBy<O> where O : DynamicObject

    extension SectionBy: CustomDebugStringConvertible, CoreStoreDebugStringConvertible

The `SectionBy` clause indicates the key path to use to group the `ListMonitor` objects into sections. An optional closure can also be provided to transform the value into an appropriate section index title:

    let monitor = dataStack.monitorSectionedList(
        From<Person>(),
        SectionBy("age") { "Age \($0)" },
        OrderBy(.ascending("lastName"))
    )

- `init(_:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections

  #### Declaration

  Swift

      public init(_ sectionKeyPath: KeyPathString)

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections

- `init(_:sectionIndexTransformer:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections, and a closure to transform the value for the key path to an appropriate section index title

  Important

  Some utilities (such as `ListMonitor`s) may keep `SectionBy`s in memory and may thus introduce retain cycles if reference captures are not handled properly.

  #### Declaration

  Swift

      public init(
          _ sectionKeyPath: KeyPathString,
          sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?
      )

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections
  `sectionIndexTransformer` | a closure to transform the value for the key path to an appropriate section index title

### CustomDebugStringConvertible

- `debugDescription`

  #### Declaration

  Swift

      public var debugDescription: String { get }

### Available where `O`: `NSManagedObject`

- `init(_:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections

  #### Declaration

  Swift

      public init<T>(_ sectionKeyPath: KeyPath<O, T>)

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections

- `init(_:sectionIndexTransformer:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections, and a closure to transform the value for the key path to an appropriate section index title

  Important

  Some utilities (such as `ListMonitor`s) may keep `SectionBy`s in memory and may thus introduce retain cycles if reference captures are not handled properly.

  #### Declaration

  Swift

      public init<T>(
          _ sectionKeyPath: KeyPath<O, T>,
          sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?
      )

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections
  `sectionIndexTransformer` | a closure to transform the value for the key path to an appropriate section index title

### Available where `O`: `CoreStoreObject`

- `init(_:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections

  #### Declaration

  Swift

      public init<T>(_ sectionKeyPath: KeyPath<O, FieldContainer<O>.Stored<T>>) where T : FieldStorableType

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections

- `init(_:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections

  #### Declaration

  Swift

      public init<T>(_ sectionKeyPath: KeyPath<O, FieldContainer<O>.Virtual<T>>)

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections

- `init(_:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections

  #### Declaration

  Swift

      public init<T>(_ sectionKeyPath: KeyPath<O, FieldContainer<O>.Coded<T>>)

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections

- `init(_:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections

  #### Declaration

  Swift

      public init<T>(_ sectionKeyPath: KeyPath<O, ValueContainer<O>.Required<T>>) where T : ImportableAttributeType

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections

- `init(_:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections

  #### Declaration

  Swift

      public init<T>(_ sectionKeyPath: KeyPath<O, ValueContainer<O>.Optional<T>>) where T : ImportableAttributeType

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections

- `init(_:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections

  #### Declaration

  Swift

      public init<T>(_ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Required<T>>) where T : NSCoding, T : NSCopying

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections

- `init(_:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections

  #### Declaration

  Swift

      public init<T>(_ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>) where T : NSCoding, T : NSCopying

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections

- `init(_:sectionIndexTransformer:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections, and a closure to transform the value for the key path to an appropriate section index title

  Important

  Some utilities (such as `ListMonitor`s) may keep `SectionBy`s in memory and may thus introduce retain cycles if reference captures are not handled properly.

  #### Declaration

  Swift

      public init<T>(
          _ sectionKeyPath: KeyPath<O, ValueContainer<O>.Required<T>>,
          sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?
      )

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections
  `sectionIndexTransformer` | a closure to transform the value for the key path to an appropriate section index title

- `init(_:sectionIndexTransformer:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections, and a closure to transform the value for the key path to an appropriate section index title

  Important

  Some utilities (such as `ListMonitor`s) may keep `SectionBy`s in memory and may thus introduce retain cycles if reference captures are not handled properly.

  #### Declaration

  Swift

      public init<T>(
          _ sectionKeyPath: KeyPath<O, FieldContainer<O>.Stored<T>>,
          sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?
      )

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections
  `sectionIndexTransformer` | a closure to transform the value for the key path to an appropriate section index title

- `init(_:sectionIndexTransformer:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections, and a closure to transform the value for the key path to an appropriate section index title

  Important

  Some utilities (such as `ListMonitor`s) may keep `SectionBy`s in memory and may thus introduce retain cycles if reference captures are not handled properly.

  #### Declaration

  Swift

      public init<T>(
          _ sectionKeyPath: KeyPath<O, FieldContainer<O>.Virtual<T>>,
          sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?
      )

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections
  `sectionIndexTransformer` | a closure to transform the value for the key path to an appropriate section index title

- `init(_:sectionIndexTransformer:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections, and a closure to transform the value for the key path to an appropriate section index title

  Important

  Some utilities (such as `ListMonitor`s) may keep `SectionBy`s in memory and may thus introduce retain cycles if reference captures are not handled properly.

  #### Declaration

  Swift

      public init<T>(
          _ sectionKeyPath: KeyPath<O, FieldContainer<O>.Coded<T>>,
          sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?
      )

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections
  `sectionIndexTransformer` | a closure to transform the value for the key path to an appropriate section index title

- `init(_:sectionIndexTransformer:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections, and a closure to transform the value for the key path to an appropriate section index title

  Important

  Some utilities (such as `ListMonitor`s) may keep `SectionBy`s in memory and may thus introduce retain cycles if reference captures are not handled properly.

  #### Declaration

  Swift

      public init<T>(
          _ sectionKeyPath: KeyPath<O, ValueContainer<O>.Optional<T>>,
          sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?
      )

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections
  `sectionIndexTransformer` | a closure to transform the value for the key path to an appropriate section index title

- `init(_:sectionIndexTransformer:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections, and a closure to transform the value for the key path to an appropriate section index title

  Important

  Some utilities (such as `ListMonitor`s) may keep `SectionBy`s in memory and may thus introduce retain cycles if reference captures are not handled properly.

  #### Declaration

  Swift

      public init<T>(
          _ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Required<T>>,
          sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?
      )

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections
  `sectionIndexTransformer` | a closure to transform the value for the key path to an appropriate section index title

- `init(_:sectionIndexTransformer:)`

  Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections, and a closure to transform the value for the key path to an appropriate section index title

  Important

  Some utilities (such as `ListMonitor`s) may keep `SectionBy`s in memory and may thus introduce retain cycles if reference captures are not handled properly.

  #### Declaration

  Swift

      public init<T>(
          _ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>,
          sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?
      )

  #### Parameters

  `sectionKeyPath` | the key path to use to group the objects into sections
  `sectionIndexTransformer` | a closure to transform the value for the key path to an appropriate section index title