Latest 1.3
Homepage https://github.com/igormatyushkin014/Hammer
License MIT
Platforms ios 9.0
Authors

Hammer


Hammer


Hammer


Hammer


Hammer

At a Glance

Hammer is a powerful tool for solving common tasks with classes and objects.

How To Get Started

  • Copy content of Source folder to your project.

or

  • Use Hammer cocoapod

Requirements

  • iOS 9 and later
  • Xcode 9 and later
  • Swift 4

Usage

Class Name

Retrieve class name:

let classNameWithNamespace = MainViewController.hmr.fullName     // "MyApplication.MainViewController"
let classNameWithoutNamespace = MainViewController.hmr.shortName // "MainViewController"

Object Conversions

Use object in external closure:

let label = UILabel().hmr.use { (label) in
            label.text = "This is a label"
}.object

Use object converted to another type in external closure:

let view = SomeView().hmr.use(as: UILabel.self) { (label) in
    label.text = "This is a label"
}.object

Object Retaining

Retain any object:

object.hmr.hold()

Release the object:

object.hmr.free()

Container

Any object can be easily wrapped by special container:

let number: NSNumber? = nil

let container = number.hmr.wrap()
container.value // nil
container.isNil // true

Just for Fun

You can replace any usage of hmr with hammer emoji:

let classNameWithNamespace = MainViewController.🔨.fullName
let classNameWithoutNamespace = MainViewController.🔨.shortName

let view = SomeView().🔨.use(as: UILabel.self) { (label) in
    label.text = "This is a label"
}.object

// etc.

License

Hammer is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Hammer",
    "version": "1.3",
    "summary": "Powerful tool for managing objects",
    "description": "Provides developer with set of classes and extensions for managing objects.",
    "homepage": "https://github.com/igormatyushkin014/Hammer",
    "screenshots": "https://github.com/igormatyushkin014/Hammer/raw/master/Images/logo_2048_2048.png",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Igor Matyushkin": "[email protected]"
    },
    "social_media_url": "https://twitter.com/imatyushkin1",
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/igormatyushkin014/Hammer.git",
        "tag": "1.3"
    },
    "source_files": [
        "Source",
        "Source/**/*"
    ],
    "swift_version": "4.0"
}

Pin It on Pinterest

Share This