Latest 1.3.0
License MIT
Platforms ios 9.0, requires ARC
Frameworks Foundation


Bismuth is part of the E-sites iOS Suite.

A lightweight framework to handle queues

forthebadge forthebadge

CocoaPods Compatible
Carthage compatible



pod 'Bismuth'

And then

pod install


import Bismuth
import Alamofire

extension Alamofire.HTTPMethod: Codable { }

struct RequestQueueItem: BismuthQueueable {
    private enum CodingKeys: String, CodingKey {
        case url
        case httpMethod
        case parameters

    private let uuid = UUID().uuidString

    let url: String
    let httpMethod: HTTPMethod
    let parameters: [String: String]?

    init(url: String, httpMethod: HTTPMethod = .get, parameters: [String: String]? = nil) {
        self.url = url
        self.httpMethod = httpMethod
        self.parameters = parameters

    static func == (lhs: RequestQueueItem, rhs: RequestQueueItem) -> Bool {
        return lhs.uuid == rhs.uuid
func configure() {
    var config = Bismuth.Config(identifier: "api-requests")
    config.logProxy = { line in
        print("[REQ] (line)")
    config.autoStart = false // Default: true
    config.canRunInBackground = false // Default: true
    config.retryTime = 30 // Default: 15

    queue = Bismuth.Queue<RequestQueueItem>(config: config)
    queue.delegate = self
    queue.add(RequestQueueItem(url: ""))
    queue.add(RequestQueueItem(url: "", httpMethod: .post, parameters: [ "name": "Bas" ]))
    queue.add(RequestQueueItem(url: "", httpMethod: .delete))

// BismuthQueueDelegate functions

func queue<T>(_ queue: Bismuth.Queue<T>, handle item: T, completion: @escaping (Bismuth.HandleResult) -> Void) where T : BismuthQueueable {
    guard let item = item as? RequestQueueItem else {

    // Do stuff with the queue item
    Alamofire.request(item.url, method: item.httpMethod, parameters: item.parameters)
    .responseJSON { response in
         switch response.result {
         case .success:
         case .failure(let error):

func queueFinished<T>(_ queue: Bismuth.Queue<T>) where T : BismuthQueueable {



Key Type Description Default
autoStart Bool Do you want the queue to auto start upon app activation? true
reryTimeInterval TimeInterval Failed queue items will retry after x seconds 15
canRunInBackground Bool Can the queue operate in the background true
logProxy (String) -> Void A closure to call for debug logging nil


Pause a queue until resume() is called

func pause()

Resumes a queue that was paused using pause()

func resume()

Starts a queue, that is idle

func start()

The current state of the queue (idle, paused or running)

var state: Bismuth.QueueState

Latest podspec

    "name": "Bismuth",
    "version": "1.3.0",
    "platforms": {
        "ios": "9.0"
    "summary": "Queue handling",
    "authors": {
        "Bas van Kuijck": "[email protected]"
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "homepage": "",
    "source": {
        "git": "",
        "tag": "1.3.0"
    "source_files": "Bismuth/**/*.{h,swift}",
    "requires_arc": true,
    "frameworks": "Foundation"

Pin It on Pinterest

Share This