Latest 1.0.1
License MIT
Platforms ios 8.0

Pooling is an interface for classes that implement object pool design pattern

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.


  • iOS 8.0+
  • Xcode 9.0+
  • Swift 4



CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Pooling into your Xcode project using CocoaPods, specify it in your Podfile:

source ''
platform :ios, '10.0'

target '<Your Target Name>' do
    pod 'Pooling', '<release version>'

Then, run the following command:

$ pod install

Swift Package Manager

Note: At this time there is no official support for iOS targets or the related system libraries in SPM. So read this before processing.

All you need is to define Pooling dependency in your package manifest file:

import PackageDescription

let package = Package(
    name: "YourPackageName",
    products: [
        .library(name: "YourPackageName", targets: ["YourPackageName"]),
    dependencies: [
        .package(url: "", from: "1.0.0"),
    targets: [
            name: "YourPackageName",
            dependencies: ["Pooling"]),
            name: "YourPackageNameTests",
            dependencies: ["Pooling"]),

and then run

$ swift fetch


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Pooling into your Xcode project using Carthage, specify it in your Cartfile:

github "" ~> 1.0.0

Run carthage update to build the framework and drag the built Pooling.framework into your Xcode project.

For more information read this


If you prefer not to use either of the aforementioned dependency managers, you can integrate Pooling into your project manually by copying Pooling.swift, Pool.swift and PThreadMutex.swift source files to your project.


Quick Start

import UIKit
import Pooling

class MyViewController: UIViewController {
    private var pool = Pool(size: 50, creator: { return UILabel(frame: })

    override func viewDidLoad() {

        // And now you ready to create your views
        let label = pool.borrow()


Pool uses a closure for creating objects, so in general case you should return object created with a designated initializer. It’s specifically important when using subclasses:

func createPool(forViewsOf type: UIView.Type) -> Pool<UIView> {
    return Pool<UIView>(size: 50) {
        return type.init(frame:


This repo uses SemVer for versioning. For the versions available, see the tags on this repository.


  • Dmitry VolosachInitial work@vlk1994


This project is licensed under the MIT License – see the LICENSE file for details


Latest podspec

    "name": "Pooling",
    "version": "1.0.1",
    "summary": "Pooling is an interface to create pools",
    "description": "Pooling provides an interface for classes that implement object pool design pattern, as well as default 'Pool' implementation",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Dmitry Volosach": "[email protected]"
    "platforms": {
        "ios": "8.0"
    "source": {
        "git": "",
        "tag": "1.0.1"
    "source_files": [
    "pushed_with_swift_version": "4.0"

Pin It on Pinterest

Share This