JobBuilder

public final class JobBuilder

Builder to create your job with behaviour

  • Type of your job that you will receive in JobCreator.create(type)

    Declaration

    Swift

    public init(type: String)
  • Allow only 1 job at the time with this ID scheduled or running Same job scheduled with same id will result in onRemove(SwiftQueueError.duplicate) if override = false If override = true the previous job will be canceled and the new job will be scheduled

    Declaration

    Swift

    public func singleInstance(forId: String, override: Bool = false) -> Self
  • Job in different groups can run in parallel

    Declaration

    Swift

    public func group(name: String) -> Self
  • Delay the execution of the job. Base on the job creation, when the job is supposed to run, If the delay is already pass (longer job before) it will run immediately Otherwise it will wait for the remaining time

    Declaration

    Swift

    public func delay(time: TimeInterval) -> Self
  • If the job hasn’t run after the date, It will be removed will call onRemove(SwiftQueueError.deadline)

    Declaration

    Swift

    public func deadline(date: Date) -> Self
  • Repeat job a certain number of time and with a interval between each run Limit of period to reproduce interval between each run. Does not affect the first iteration. Please add delay if so

    Declaration

    Swift

    public func periodic(limit: Limit = .unlimited, interval: TimeInterval = 0) -> Self
  • Connectivity constraint.

    Declaration

    Swift

    public func internet(atLeast: NetworkType) -> Self
  • Job should be persisted.

    Declaration

    Swift

    public func persist(required: Bool) -> Self
  • Limit number of retry. Overall for the lifecycle of the SwiftQueueManager. For a periodic job, the retry count will not be reset at each period.

    Declaration

    Swift

    public func retry(limit: Limit) -> Self
  • Custom tag to mark the job

    Declaration

    Swift

    public func addTag(tag: String) -> Self
  • Custom parameters will be forwarded to create method

    Declaration

    Swift

    public func with(params: [String : Any]) -> Self
  • Set to true if the job can only run when the device is charging

    Declaration

    Swift

    public func requireCharging(value: Bool) -> Self
  • Add job to the JobQueue

    Declaration

    Swift

    public func schedule(manager: SwiftQueueManager)