DIScanPart

open class DIScanPart : DIScan, DIPart

Allows you to find all parts marked as DIScanned in the application that satisfy certain characteristics: predicate - allows you to check a part type both by its name or using the type itself bundle - leaves only those parts that are in the specified bundle Using:

class YourScanPart: DIScanPart {
  override class var predicate: Predicate? { return .name({ $0.contains("ScannedPart") }) }
  override class var bundle: Bundle? { return YourBundle() }
}

OR

class YourScanPart: DIScanPart {
  override class var predicate: Predicate? { return .type({ $0 is YourCustomPartBase.Type }) }
  override class var bundle: Bundle? { return Bundle(for: YourClass.self) }
}
  • Variants of the predicate on the basis of which these parts will be included.

    • type->Bool: Allows you to specify method that will filter a parts by type.
    • name->Bool: Allows you to specify method that will filter a parts by name.
    See more

    Declaration

    Swift

    public enum Predicate
  • Predicate on the basis of which these parts will be included.

    Declaration

    Swift

    open class var predicate: Predicate? { get }
  • It allows you to cut off parts not belonging to the specified bundle.

    Declaration

    Swift

    open class var bundle: Bundle? { get }
  • implementation of the function for scan.

    Declaration

    Swift

    public static func load(container: DIContainer)