Latest 0.2.1
Homepage https://github.com/takecian/SimpleInstantiate
License MIT
Platforms ios 8.0
Authors

SimpleInstantiate is pure Swift library which instantiates objects in simple way.

Features

  • Instantiate custom UITableViewCell without Cell Reuse Identifier
  • Instantiate custom UICollectionViewCell without Cell Reuse Identifier
  • Instantiate custom UIView from xib without specifying xib file name

Install

Cocoapods

pod 'SimpleInstantiate'

Carthage

github "takecian/SimpleInstantiate" "0.1.1"

Directly

Drag & drop files in SimpleInstantiate directory into your project.

Usage

Instantiate custom UIView from xib

class CustomView: UIView, NibLoadableView {
}

let view = InstanceFactory.createInstance(CustomView.self)

Note: Xib file name should be same as class name.(e.g. ‘CustomView.swift’ and ‘CustomView.xib’)

UITableView without xib

tableView.registerClass(CustomTableViewCell.self)

let cell = tableView.dequeueReusableCell(CustomTableViewCell.self)

UITableView with xib

class CustomTableViewCell: UITableViewCell, NibLoadableView {
}

tableView.registerNib(CustomTableViewCell.self)

let cell = tableView.dequeueReusableCell(CustomTableViewCell.self)

Latest podspec

{
    "name": "SimpleInstantiate",
    "version": "0.2.1",
    "summary": "Simple way to instantiate in Swift.",
    "homepage": "https://github.com/takecian/SimpleInstantiate",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "takecian": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/takecian/SimpleInstantiate.git",
        "tag": "0.2.1"
    },
    "source_files": "SimpleInstantiate/*.swift",
    "social_media_url": "https://twitter.com/takecian",
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This