Latest 1.0.0
Homepage https://github.com/Peterek/custom-xib-view
License MIT
Platforms ios 9.0, requires ARC
Frameworks UIKit
Authors


CocoaPods


Carthage

Example

There are several ways to use CustomXibView

Setting Xib Name in Interface Builder

If you view is not complicated, you can just:

  • Place UIView in you Interface Builder
  • Set its class to CustomXibView in Identity Inspector
  • Set the name of your custom xib view in Attributes Inspector

Alt Text

Deriving from CustomXibView

To implement more complex behaviour:
Set its class to your class derived from CustomXibView in Identity Inspector
If class name is the same as xib name, there is no need to provide the xib name.
Otherwise you can set the xib name in Attributes Inspector or in your class by overriding xibName property.

import UIKit

class PartyParrot: CustomXibView {
}

class BTCView: CustomXibView {

    override var xibName: String {
        return "BTC"
    }

}

Alt Text

Creating CustomXibView programmatically

You can create CustomXibView by calling its init(frame:).
Then it can be added as subview in code.

Usage

Manual

  • Drag the file CustomXibView.swift into your application’s Xcode project.

CocoaPods

  • pod ‘CustomXibView’

Latest podspec

{
    "name": "CustomXibView",
    "version": "1.0.0",
    "summary": "A simple way to reuse views created in xibs.",
    "homepage": "https://github.com/Peterek/custom-xib-view",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Piotr Wiu0119caszek": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/Peterek/custom-xib-view.git",
        "tag": "1.0.0",
        "submodules": true
    },
    "source_files": "Sources/**/*",
    "frameworks": "UIKit",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This