Latest 3.0.0
Homepage https://github.com/giginet/NibLoaderKit
License MIT
Platforms ios 8.0, osx 10.10, tvos 9.0, requires ARC
Authors

Build Status
codecov
Language
Carthage compatible
CocoaPods Compatible
Platform
License

This is a tiny utility to load UIView/NSView from nibs.

Usage

1. Declare CustomView class

class CustomView: UIView { }

2. Place CustomView.xib

  • xib must contains just one top level view.

3. Set custom class

  • Set custom class of the top level view to CustomView.

NibLoaderKit

4. Load from the code

let customView: CustomView = try! CustomView.view(with: self)

CustomView.xib will be loaded and generate the view.

Nib names are guessed automatically by class name. they would be demodulized.

You can also pass the nibName and bundle.

let customView: UIView = try! UIView.view(
    from: "MyCustomView", 
    owner: self, 
    bundle: Bundle(forClass: self.dynamicType)
)

Installation

Carthage

github "giginet/NibLoaderKit"

CocoaPods

use_frameworks!

pod 'NibLoaderKit'

Requirements

  • = iOS 8

  • = macOS 10.10

  • = tvOS 9

  • Swift 4.1
  • Xcode 9.4

LICENSE

MIT License

Latest podspec

{
    "name": "NibLoaderKit",
    "version": "3.0.0",
    "summary": "Tiny utility to load UIView/NSView from nibs",
    "homepage": "https://github.com/giginet/NibLoaderKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "giginet": "[email protected]"
    },
    "social_media_url": "http://twitter.com/giginet",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/giginet/NibLoaderKit.git",
        "tag": "3.0.0"
    },
    "source_files": "Sources/*.{h,swift}",
    "tvos": {
        "source_files": "Sources/iOS/*.{h,swift}"
    },
    "ios": {
        "source_files": "Sources/iOS/*.{h,swift}"
    },
    "osx": {
        "source_files": "Sources/macOS/*.{h,swift}"
    },
    "swift_version": "4.1",
    "requires_arc": true
}

Pin It on Pinterest

Share This