Configuration

public struct Configuration

The Configuration is used to configure Cauli at initialization time. The Configuration.standard is a sensibly chosen configuration set.

  • The default Configuration.

    • Configuration:
      • recordSelector: Only records to a maximum of 5 MB are considered.
      • enableShakeGesture: The shake gesture is enabled.
      • storageCapacity: The storage capacity is limited to 50 records,.
      • preStorageRecordModifier: A RecordModifier that can modify records before they are stored.

    Declaration

    Swift

    public static let standard: Configuration
  • Defines if a Record should be handled. This can be used to only select Records by a specific domain, a filetype, a maximum filesize or such.

    Examples

    // Only records for the domain cauli.works are selected.
    RecordSelector { $0.originalRequest.url?.host == "cauli.works" }
    
    // Only records with a response body of max 10 MB are selected.
    RecordSelector.max(bytesize: 10 * 1024 * 1024)
    

    Declaration

    Swift

    public let recordSelector: RecordSelector
  • If enableShakeGesture is set to true, Cauli will try to hook into the UIWindow.motionEnded(:UIEvent.EventSubtype, with: UIEvent?) function to display the Cauli UI whenever the device is shaken. If that function is overridden the Cauli automatism doesn’t work. In that case, you can use the Cauli.viewController() function to display that ViewController manually.

    Declaration

    Swift

    public let enableShakeGesture: Bool
  • The storageCapacity defines the capacity of the storage.

    Declaration

    Swift

    public let storageCapacity: StorageCapacity
  • This RecordModifier allows the Storage to modify records before they are stored. This allows you to change details of a record before it is passed along to a presentation floret, like for example the InspectorFloret.

    Declaration

    Swift

    public var preStorageRecordModifier: RecordModifier?
  • Creates a new Configuration with the given parameters. Please check the properties of a Configuration for their meaning.

    Declaration

    Swift

    public init(recordSelector: RecordSelector, enableShakeGesture: Bool, storageCapacity: StorageCapacity, preStorageRecordModifier: RecordModifier? = nil)